Skip to content

Inconsistent behavior with negation pattern in .gitignore #2731

@Nadrieril

Description

@Nadrieril

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

  • I have a different issue.

What version of ripgrep are you using?

ripgrep 13.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

Using nix

What operating system are you using ripgrep on?

NixOS 23.11

Describe your bug.

See below. Feels related to #1050 but I think they're different.

What are the steps to reproduce the behavior?

Make a repo with:

.gitignore

build/
!/some_dir/build/

some_dir/build/foo

string

What is the actual behavior?

> rg -l string
some_dir/build/foo
> rg -l string some_dir
# nothing
> rg -l string some_dir/build
some_dir/build/foo

What is the expected behavior?

rg -l string some_dir should find the file too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug.rollupA PR that has been merged with many others in a rollup.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions