mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-31 04:02:00 -07:00
ignore: fix gitignore parsing bug for trailing \/
When a glob pattern ended with a \/, and since we permit backslash escapes, the glob parser gave a "dangling escape" error. Which is weird, because the \ is clearly not dangling. The issue is that the layer above the glob parser, the gitignore parser, was stripping the trailing / so that it wouldn't be part of the matching logic. Of course, stripping the trailing / while it is escaped without removing the backslash escape is wrong. So we do that here. Fixes #2236
This commit is contained in:
@@ -1118,3 +1118,11 @@ pipc () { # [-h] [-U|-u <pkgspec>[,<pkgspec>...]] [<reqs-in>...] [-- <pip-compi
|
||||
let expected = " [-h] [-U|-u <pkgspec>[,<pkgspec>...]] [<reqs-in>...] [-- <pip-compile-arg>...]\n";
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/2236
|
||||
rgtest!(r2236, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create(".ignore", r"foo\/");
|
||||
dir.create_dir("foo");
|
||||
dir.create("foo/bar", "test\n");
|
||||
cmd.args(&["test"]).assert_err();
|
||||
});
|
||||
|
Reference in New Issue
Block a user