Finally fix tests

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
epel9
Igor Gnatenko 7 years ago
parent b77b3cb996
commit 433a029d0b
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C

@ -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>
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)
---

@ -1,7 +1,7 @@
From 7f8d42ff8e2e73f302c97589ce6ff5beeb36051c Mon Sep 17 00:00:00 2001
From dd556db0ec912d7cc90204deb78835f66cb0ae3b Mon Sep 17 00:00:00 2001
From: Andrew Gallant <jamslam@gmail.com>
Date: Sun, 29 Jul 2018 10:15:20 -0400
Subject: [PATCH 2/2] tests: reduce reliance on state in tests
Subject: [PATCH 3/3] tests: reduce reliance on state in tests
This commit improves the integration test setup by running tests inside
the system's temporary directory instead of within ripgrep's `target`
@ -33,7 +33,7 @@ Fixes #448, #996
2 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/tests/tests.rs b/tests/tests.rs
index 34bf08e..9569c07 100644
index 903c470..9080aaf 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -575,6 +575,7 @@ sherlock!(no_ignore_hidden, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
@ -44,7 +44,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "sherlock\n");
wd.assert_err(&mut cmd);
});
@@ -774,6 +775,7 @@ sherlock:5:12:but Doctor Watson has to have it taken out for him and dusted,
@@ -776,6 +777,7 @@ sherlock:5:12:but Doctor Watson has to have it taken out for him and dusted,
// See: https://github.com/BurntSushi/ripgrep/issues/16
clean!(regression_16, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
@ -52,7 +52,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "ghi/");
wd.create_dir("ghi");
wd.create_dir("def/ghi");
@@ -833,6 +835,7 @@ clean!(regression_50, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
@@ -835,6 +837,7 @@ clean!(regression_50, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
// See: https://github.com/BurntSushi/ripgrep/issues/65
clean!(regression_65, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
@ -60,7 +60,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "a/");
wd.create_dir("a");
wd.create("a/foo", "xyz");
@@ -842,6 +845,7 @@ clean!(regression_65, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
@@ -844,6 +847,7 @@ clean!(regression_65, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
// See: https://github.com/BurntSushi/ripgrep/issues/67
clean!(regression_67, "test", ".", |wd: WorkDir, mut cmd: Command| {
@ -68,7 +68,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "/*\n!/dir");
wd.create_dir("dir");
wd.create_dir("foo");
@@ -854,6 +858,7 @@ clean!(regression_67, "test", ".", |wd: WorkDir, mut cmd: Command| {
@@ -856,6 +860,7 @@ clean!(regression_67, "test", ".", |wd: WorkDir, mut cmd: Command| {
// See: https://github.com/BurntSushi/ripgrep/issues/87
clean!(regression_87, "test", ".", |wd: WorkDir, mut cmd: Command| {
@ -76,7 +76,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "foo\n**no-vcs**");
wd.create("foo", "test");
wd.assert_err(&mut cmd);
@@ -861,6 +866,7 @@ clean!(regression_87, "test", ".", |wd: WorkDir, mut cmd: Command| {
@@ -863,6 +868,7 @@ clean!(regression_87, "test", ".", |wd: WorkDir, mut cmd: Command| {
// See: https://github.com/BurntSushi/ripgrep/issues/90
clean!(regression_90, "test", ".", |wd: WorkDir, mut cmd: Command| {
@ -84,7 +84,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "!.foo");
wd.create(".foo", "test");
@@ -921,6 +927,7 @@ clean!(regression_127, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
@@ -923,6 +929,7 @@ clean!(regression_127, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
// ripgrep should ignore 'foo/sherlock' giving us results only from
// 'foo/watson' but on Windows ripgrep will include both 'foo/sherlock' and
// 'foo/watson' in the search results.
@ -92,7 +92,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "foo/sherlock\n");
wd.create_dir("foo");
wd.create("foo/sherlock", hay::SHERLOCK);
@@ -948,6 +955,7 @@ clean!(regression_128, "x", ".", |wd: WorkDir, mut cmd: Command| {
@@ -950,6 +957,7 @@ clean!(regression_128, "x", ".", |wd: WorkDir, mut cmd: Command| {
// TODO(burntsushi): Darwin doesn't like this test for some reason.
#[cfg(not(target_os = "macos"))]
clean!(regression_131, "test", ".", |wd: WorkDir, mut cmd: Command| {
@ -100,7 +100,7 @@ index 34bf08e..9569c07 100644
wd.create(".gitignore", "TopÑapa");
wd.create("TopÑapa", "test");
wd.assert_err(&mut cmd);
@@ -1235,6 +1243,7 @@ clean!(regression_599, "^$", "input.txt", |wd: WorkDir, mut cmd: Command| {
@@ -1237,6 +1245,7 @@ clean!(regression_599, "^$", "input.txt", |wd: WorkDir, mut cmd: Command| {
// See: https://github.com/BurntSushi/ripgrep/issues/807
clean!(regression_807, "test", ".", |wd: WorkDir, mut cmd: Command| {

@ -24,8 +24,9 @@ Patch1: 0001-deps-update-regex-crate.patch
# https://github.com/BurntSushi/ripgrep/pull/858
Patch2: 0001-grep-upgrade-to-regex-syntax-0.5.patch
# https://github.com/BurntSushi/ripgrep/pull/998
Patch3: 0001-tests-style-80-columns-dammit.patch
Patch4: 0002-tests-reduce-reliance-on-state-in-tests.patch
Patch3: 0001-ignore-only-respect-.gitignore-in-git-repos.patch
Patch4: 0002-tests-style-80-columns-dammit.patch
Patch5: 0003-tests-reduce-reliance-on-state-in-tests.patch
ExclusiveArch: %{rust_arches}

Loading…
Cancel
Save