summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2020-03-15 11:04:47 -0400
committerAndrew Gallant <jamslam@gmail.com>2020-03-15 13:19:14 -0400
commitc4c43c733ee9a44d3a48aa7f22284a6db6f0f9c6 (patch)
treeca7d8656f03c8f1d2e32d89c23855a526c3120f4 /tests
parent447506ebe02f1475734b66137feb02ae0fd9decf (diff)
cli: add --no-ignore-files flag
The purpose of this flag is to force ripgrep to ignore all --ignore-file flags (whether they come before or after --no-ignore-files). This flag can be overridden with --ignore-files. Fixes #1466
Diffstat (limited to 'tests')
-rw-r--r--tests/feature.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/feature.rs b/tests/feature.rs
index 0ae21c1a..e140fdfe 100644
--- a/tests/feature.rs
+++ b/tests/feature.rs
@@ -754,7 +754,7 @@ rgtest!(f1414_no_require_git, |dir: Dir, mut cmd: TestCommand| {
});
// See: https://github.com/BurntSushi/ripgrep/pull/1420
-rgtest!(f1420_no_ignore_dot, |dir: Dir, mut cmd: TestCommand| {
+rgtest!(f1420_no_ignore_exclude, |dir: Dir, mut cmd: TestCommand| {
dir.create_dir(".git/info");
dir.create(".git/info/exclude", "foo");
dir.create("bar", "");
@@ -765,6 +765,28 @@ rgtest!(f1420_no_ignore_dot, |dir: Dir, mut cmd: TestCommand| {
eqnice!("bar\nfoo\n", cmd.arg("--no-ignore-exclude").stdout());
});
+// See: https://github.com/BurntSushi/ripgrep/pull/1466
+rgtest!(f1466_no_ignore_files, |dir: Dir, mut cmd: TestCommand| {
+ dir.create(".myignore", "bar");
+ dir.create("bar", "");
+ dir.create("foo", "");
+
+ // Test that --no-ignore-files disables --ignore-file.
+ // And that --ignore-files overrides --no-ignore-files.
+ cmd.arg("--sort").arg("path").arg("--files");
+ eqnice!("bar\nfoo\n", cmd.stdout());
+ eqnice!("foo\n", cmd.arg("--ignore-file").arg(".myignore").stdout());
+ eqnice!("bar\nfoo\n", cmd.arg("--no-ignore-files").stdout());
+ eqnice!("foo\n", cmd.arg("--ignore-files").stdout());
+
+ // Test that the -u flag does not disable --ignore-file.
+ let mut cmd = dir.command();
+ cmd.arg("--sort").arg("path").arg("--files");
+ cmd.arg("--ignore-file").arg(".myignore");
+ eqnice!("foo\n", cmd.stdout());
+ eqnice!("foo\n", cmd.arg("-u").stdout());
+});
+
rgtest!(no_context_sep, |dir: Dir, mut cmd: TestCommand| {
dir.create("test", "foo\nctx\nbar\nctx\nfoo\nctx");
cmd.args(&["-A1", "--no-context-separator", "foo", "test"]);