parent
b77b3cb996
commit
433a029d0b
@ -0,0 +1,47 @@
|
|||||||
|
From e4f995b59622a66bc6f02274f0db09634603dc17 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||||
|
Date: Sun, 29 Jul 2018 20:12:43 +0200
|
||||||
|
Subject: [PATCH 1/3] ignore: only respect .gitignore in git repos
|
||||||
|
|
||||||
|
This commit fixes an interesting bug in the `ignore` crate where it
|
||||||
|
would basically respect any `.gitignore` file anywhere (including global
|
||||||
|
gitignores in `~/.config/git/ignore`), regardless of whether we were
|
||||||
|
searching in a git repository or not. This commit rectifies that
|
||||||
|
behavior to only respect gitignore rules when in a git repo.
|
||||||
|
|
||||||
|
The key change here is to move the logic of whether to traverse parents
|
||||||
|
into the directory matcher rather than putting the onus on the directory
|
||||||
|
traverser. In particular, we now need to traverse parent directories in
|
||||||
|
more cases than we previously did, since we need to determine whether
|
||||||
|
we're in a git repository or not.
|
||||||
|
|
||||||
|
Fixes #934
|
||||||
|
|
||||||
|
(cherry picked from commit e65ca21a6cebceb9ba79fcd164da24478cc01fb0)
|
||||||
|
---
|
||||||
|
tests/tests.rs | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/tests/tests.rs b/tests/tests.rs
|
||||||
|
index 34bf08e..903c470 100644
|
||||||
|
--- a/tests/tests.rs
|
||||||
|
+++ b/tests/tests.rs
|
||||||
|
@@ -662,6 +662,7 @@ sherlock!(no_parent_ignore_git, "Sherlock", ".",
|
||||||
|
|wd: WorkDir, mut cmd: Command| {
|
||||||
|
// Set up a directory hierarchy like this:
|
||||||
|
//
|
||||||
|
+ // .git/
|
||||||
|
// .gitignore
|
||||||
|
// foo/
|
||||||
|
// .gitignore
|
||||||
|
@@ -679,6 +680,7 @@ sherlock!(no_parent_ignore_git, "Sherlock", ".",
|
||||||
|
// In other words, we should only see results from `sherlock`, not from
|
||||||
|
// `watson`.
|
||||||
|
wd.remove("sherlock");
|
||||||
|
+ wd.create_dir(".git");
|
||||||
|
wd.create(".gitignore", "sherlock\n");
|
||||||
|
wd.create_dir("foo");
|
||||||
|
wd.create("foo/.gitignore", "watson\n");
|
||||||
|
--
|
||||||
|
2.18.0
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
From c66f7857e36102cdb7a2518650d5053b7d55e467 Mon Sep 17 00:00:00 2001
|
From f4c5480c1d6230f9267c7ef435f81656f8e9c900 Mon Sep 17 00:00:00 2001
|
||||||
From: Andrew Gallant <jamslam@gmail.com>
|
From: Andrew Gallant <jamslam@gmail.com>
|
||||||
Date: Sun, 29 Jul 2018 09:40:38 -0400
|
Date: Sun, 29 Jul 2018 09:40:38 -0400
|
||||||
Subject: [PATCH 1/2] tests/style: 80 columns, dammit
|
Subject: [PATCH 2/3] tests/style: 80 columns, dammit
|
||||||
|
|
||||||
(cherry picked from commit 7c412bb2fa343a8d54090ea175c851cd822d8f62)
|
(cherry picked from commit 7c412bb2fa343a8d54090ea175c851cd822d8f62)
|
||||||
---
|
---
|
Loading…
Reference in new issue