Switch from .rgignore to .ignore.

But don't actually remove support for .rgignore until the next semver
bump.

Note that this puts us in line with the silver searcher:
https://github.com/ggreer/the_silver_searcher/pull/974

Fixes #40
This commit is contained in:
Andrew Gallant 2016-09-23 22:44:17 -04:00
parent f5eb36baac
commit cc90511ab2
7 changed files with 15 additions and 9 deletions

View File

@ -145,9 +145,9 @@ files, ignore hidden files and directories and skip binary files:
$ rg foobar $ rg foobar
``` ```
The above command also respects all `.rgignore` files, including in parent The above command also respects all `.ignore` files, including in parent
directories. `.rgignore` files can be used when `.gitignore` files are directories. `.ignore` files can be used when `.gitignore` files are
insufficient. In all cases, `.rgignore` patterns take precedence over insufficient. In all cases, `.ignore` patterns take precedence over
`.gitignore`. `.gitignore`.
To ignore all ignore files, use `-u`. To additionally search hidden files To ignore all ignore files, use `-u`. To additionally search hidden files

View File

@ -211,8 +211,8 @@ Never use memory maps, even when they might be faster.
.RE .RE
.TP .TP
.B \-\-no\-ignore .B \-\-no\-ignore
Don\[aq]t respect ignore files (.gitignore, .rgignore, etc.) This Don\[aq]t respect ignore files (.gitignore, .ignore, etc.) This implies
implies \-\-no\-ignore\-parent. \-\-no\-ignore\-parent.
.RS .RS
.RE .RE
.TP .TP

View File

@ -137,7 +137,7 @@ the raw speed of grep.
: Never use memory maps, even when they might be faster. : Never use memory maps, even when they might be faster.
--no-ignore --no-ignore
: Don't respect ignore files (.gitignore, .rgignore, etc.) : Don't respect ignore files (.gitignore, .ignore, etc.)
This implies --no-ignore-parent. This implies --no-ignore-parent.
--no-ignore-parent --no-ignore-parent

View File

@ -137,7 +137,7 @@ Less common options:
Never use memory maps, even when they might be faster. Never use memory maps, even when they might be faster.
--no-ignore --no-ignore
Don't respect ignore files (.gitignore, .rgignore, etc.) Don't respect ignore files (.gitignore, .ignore, etc.)
This implies --no-ignore-parent. This implies --no-ignore-parent.
--no-ignore-parent --no-ignore-parent

View File

@ -9,7 +9,7 @@ The motivation for this submodule is performance and portability:
2. We could shell out to a `git` sub-command like ls-files or status, but it 2. We could shell out to a `git` sub-command like ls-files or status, but it
seems better to not rely on the existence of external programs for a search seems better to not rely on the existence of external programs for a search
tool. Besides, we need to implement this logic anyway to support things like tool. Besides, we need to implement this logic anyway to support things like
an .rgignore file. an .ignore file.
The key implementation detail here is that a single gitignore file is compiled The key implementation detail here is that a single gitignore file is compiled
into a single RegexSet, which can be used to report which globs match a into a single RegexSet, which can be used to report which globs match a

View File

@ -5,7 +5,7 @@ whether a *single* file path should be searched or not.
In general, there are two ways to ignore a particular file: In general, there are two ways to ignore a particular file:
1. Specify an ignore rule in some "global" configuration, such as a 1. Specify an ignore rule in some "global" configuration, such as a
$HOME/.rgignore or on the command line. $HOME/.ignore or on the command line.
2. A specific ignore file (like .gitignore) found during directory traversal. 2. A specific ignore file (like .gitignore) found during directory traversal.
The `IgnoreDir` type handles ignore patterns for any one particular directory The `IgnoreDir` type handles ignore patterns for any one particular directory
@ -24,6 +24,7 @@ use types::Types;
const IGNORE_NAMES: &'static [&'static str] = &[ const IGNORE_NAMES: &'static [&'static str] = &[
".gitignore", ".gitignore",
".ignore",
".rgignore", ".rgignore",
]; ];

View File

@ -377,6 +377,11 @@ sherlock!(ignore_git, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.assert_err(&mut cmd); wd.assert_err(&mut cmd);
}); });
sherlock!(ignore_generic, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.create(".ignore", "sherlock\n");
wd.assert_err(&mut cmd);
});
sherlock!(ignore_ripgrep, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| { sherlock!(ignore_ripgrep, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
wd.create(".rgignore", "sherlock\n"); wd.create(".rgignore", "sherlock\n");
wd.assert_err(&mut cmd); wd.assert_err(&mut cmd);