Open
Description
Please tick this box to confirm you have reviewed the above.
- I have a different issue.
What version of ripgrep are you using?
ripgrep 14.1.0 (rev e50df40)
features:-simd-accel,+pcre2
simd(compile):+SSE2,-SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,+AVX2
PCRE2 10.42 is available (JIT is available)
How did you install ripgrep?
Github release ripgrep_14.1.0-1_amd64.deb
What operating system are you using ripgrep on?
WSL2: Ubuntu (Linux x64 5.10.102.1-microsoft-standard-WSL2)
Describe your bug.
Ripgrep doesn't interpret *[\<\>\:\"\/\\\|\?\*]*
in .gitignore
in the same way that git does.
What are the steps to reproduce the behavior?
- Create the following file structure:
.
├── folder
│ └── bar.txt
└── foo.txt
└── .gitignore
where the gitignore contains the following:
#-----------------------------
# INVALID FILES
# (for cross OS compatibility)
#-----------------------------
*[\<\>\:\"\/\\\|\?\*]*
git init
git status
-> notice that no files are ignored by git.rg --files
-> notice that onlyfoo.txt
is picked up, notbar.txt
.
What is the actual behavior?
$ rg --files --debug
rg: DEBUG|rg::flags::parse|crates/core/flags/parse.rs:97: no extra arguments found from configuration file
rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1099: using heuristics to determine whether to read from stdin or search ./ (is_readable_stdin=false, stdin_consumed=false, mode=Files)
rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1109: heuristic chose to search ./
rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1260: found hostname for hyperlink configuration: DESKTOP-956ATPJ
rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1264: found wsl_prefix for hyperlink configuration: wsl$/Ubuntu
rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1270: hyperlink format: ""
rg: DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:174: using 8 thread(s)
rg: DEBUG|globset|crates/globset/src/lib.rs:448: glob converted to regex: Glob { glob: "*[\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]*", re: "(?-u)^[^/]*[\\\\<\\\\>\\\\:\\\\\"\\\\/\\\\\\\\\\\\\\|\\\\\\?\\\\\\*][^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Class { negated: false, ranges: [('\\', '\\'), ('<', '<'), ('\\', '\\'), ('>', '>'), ('\\', '\\'), (':', ':'), ('\\', '\\'), ('"', '"'), ('\\', '\\'), ('/', '/'), ('\\', '\\'), ('\\', '\\'), ('\\', '\\'), ('|', '|'), ('\\', '\\'), ('?', '?'), ('\\', '\\'), ('*', '*')] }, ZeroOrMore]) }
rg: DEBUG|globset|crates/globset/src/lib.rs:453: built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes
rg: DEBUG|ignore::walk|crates/ignore/src/walk.rs:1799: ignoring ./.gitignore: Ignore(IgnoreMatch(Hidden))
rg: DEBUG|ignore::walk|crates/ignore/src/walk.rs:1799: ignoring ./.git: Ignore(IgnoreMatch(Hidden))
rg: DEBUG|ignore::walk|crates/ignore/src/walk.rs:1799: ignoring ./folder/bar.txt: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("./.gitignore"), original: "*[\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]*", actual: "*[\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]*", is_whitelist: false, is_only_dir: false })))
foo.txt
What is the expected behavior?
ripgrep should have returned:
folder/bar.txt
foo.txt