Skip to content

not searching inside gitignored path even when given explicit path #3251

@davidszotten

Description

@davidszotten

Please tick this box to confirm you have reviewed the above.

  • I have a different issue.

What version of ripgrep are you using?

$ rg --version
ripgrep 15.1.0

features:+pcre2
simd(compile):+NEON
simd(runtime):+NEON

PCRE2 10.45 is available (JIT is available)

How did you install ripgrep?

homebrew

What operating system are you using ripgrep on?

osx 14.8

Describe your bug.

i have a situation similar (but notably different) to #2595
where it was said

You explicitly asked ripgrep to search dir. Even if dir is ignored, ripgrep will respect your request because doing otherwise is bonkers IMO.

however, unless i'm mistaken, this doesn't happen if dir contains a .gitignore file with the contents * (common eg in .venv folders)

What are the steps to reproduce the behavior?

#/bin/bash
mkdir git_ignore_issue
cd git_ignore_issue
git init
mkdir -p dir/sub
echo "here" >> dir/sub/here.txt
echo '*' > dir/.gitignore
echo "Searching with rg"
rg here dir/sub

What is the actual behavior?

nothing found

What is the expected behavior?

should bypass dir's gitignore since we are explicitly specifying to search it or a subdir

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixA feature or bug that is unlikely to be implemented or fixed.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions