summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-01-23 19:46:15 -0500
committerAndrew Gallant <jamslam@gmail.com>2019-01-23 19:59:39 -0500
commit9c940b45f4f81b51eee7dcf5836fb3680cf6b62c (patch)
tree8a8814010eeeb6c69b9b248764bb19ee23001c57 /tests
parent0a167021c36f6946fc586f4c76e66ab627f4cc04 (diff)
globset: permit ** to appear anywhere
Previously, `man gitignore` specified that `**` was invalid unless it was used in one of a few specific circumstances, i.e., `**`, `a/**`, `**/b` or `a/**/b`. That is, `**` always had to be surrounded by either a path separator or the beginning/end of the pattern. It turns out that git itself has treated `**` outside the above contexts as valid for quite a while, so there was an inconsistency between the spec `man gitignore` and the implementation, and it wasn't clear which was actually correct. @okdana filed a bug against git[1] and got this fixed. The spec was wrong, which has now been fixed [2] and updated[2]. This commit brings ripgrep in line with git and treats `**` outside of the above contexts as two consecutive `*` patterns. We deprecate the `InvalidRecursive` error since it is no longer used. Fixes #373, Fixes #1098 [1] - https://public-inbox.org/git/C16A9F17-0375-42F9-90A9-A92C9F3D8BBA@dana.is [2] - https://github.com/git/git/commit/627186d0206dcb219c43f8e6670b4487802a4921 [3] - https://git-scm.com/docs/gitignore
Diffstat (limited to 'tests')
-rw-r--r--tests/regression.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/regression.rs b/tests/regression.rs
index 8435f174..b8dc26d0 100644
--- a/tests/regression.rs
+++ b/tests/regression.rs
@@ -569,6 +569,14 @@ rgtest!(r1064, |dir: Dir, mut cmd: TestCommand| {
eqnice!("input:abc\n", cmd.arg("a(.*c)").stdout());
});
+// See: https://github.com/BurntSushi/ripgrep/issues/1174
+rgtest!(r1098, |dir: Dir, mut cmd: TestCommand| {
+ dir.create_dir(".git");
+ dir.create(".gitignore", "a**b");
+ dir.create("afoob", "test");
+ cmd.arg("test").assert_err();
+});
+
// See: https://github.com/BurntSushi/ripgrep/issues/1130
rgtest!(r1130, |dir: Dir, mut cmd: TestCommand| {
dir.create("foo", "test");