mirror of
https://github.com/sharkdp/fd
synced 2024-07-05 09:19:11 +00:00
docs: Document exclusion of .git/
This commit is contained in:
parent
5e0018fb1f
commit
53fd416c47
12
doc/fd.1
vendored
12
doc/fd.1
vendored
|
@ -29,11 +29,22 @@ By default
|
||||||
.B fd
|
.B fd
|
||||||
uses regular expressions for the pattern. However, this can be changed to use simple glob patterns
|
uses regular expressions for the pattern. However, this can be changed to use simple glob patterns
|
||||||
with the '\-\-glob' option.
|
with the '\-\-glob' option.
|
||||||
|
.P
|
||||||
|
By default
|
||||||
|
.B fd
|
||||||
|
will exclude hidden files and directories, as well as any files that match gitignore rules
|
||||||
|
or ignore rules in .ignore or .fdignore files. For convenenience, '.git' is treated as if it
|
||||||
|
was always included in gitignore rules. These files can be included with options such as
|
||||||
|
'\-\-hidden' and '\-\-no\-ignore'.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B \-H, \-\-hidden
|
.B \-H, \-\-hidden
|
||||||
Include hidden files and directories in the search results
|
Include hidden files and directories in the search results
|
||||||
(default: hidden files and directories are skipped). The flag can be overridden with '--no-hidden'.
|
(default: hidden files and directories are skipped). The flag can be overridden with '--no-hidden'.
|
||||||
|
.IP
|
||||||
|
Ignored files and .git/ are still excluded unless \-\-no\-ignore or \-\-no\-ignore\-vcs
|
||||||
|
is also used. The .git directory is excluded, because that is usually what is wanted if excluding vcs
|
||||||
|
ignored files, and is more consistent with the output of most git commands.
|
||||||
.TP
|
.TP
|
||||||
.B \-I, \-\-no\-ignore
|
.B \-I, \-\-no\-ignore
|
||||||
Show search results from files and directories that would otherwise be ignored by
|
Show search results from files and directories that would otherwise be ignored by
|
||||||
|
@ -69,6 +80,7 @@ and the global gitignore configuration
|
||||||
.RI ( core.excludesFile
|
.RI ( core.excludesFile
|
||||||
git setting, which defaults to
|
git setting, which defaults to
|
||||||
.IR $HOME/.config/git/ignore ).
|
.IR $HOME/.config/git/ignore ).
|
||||||
|
The pattern ".git/" is automatically added to the list of VCS ignore rules.
|
||||||
The flag can be overridden with '--ignore-vcs'.
|
The flag can be overridden with '--ignore-vcs'.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no\-require\-git
|
.B \-\-no\-require\-git
|
||||||
|
|
|
@ -32,6 +32,8 @@ pub struct Opts {
|
||||||
/// Include hidden directories and files in the search results (default:
|
/// Include hidden directories and files in the search results (default:
|
||||||
/// hidden files and directories are skipped). Files and directories are
|
/// hidden files and directories are skipped). Files and directories are
|
||||||
/// considered to be hidden if their name starts with a `.` sign (dot).
|
/// considered to be hidden if their name starts with a `.` sign (dot).
|
||||||
|
/// Any files or directories that are ignored due to the rules described by
|
||||||
|
/// --no-ignore are still ignored unless otherwise specified.
|
||||||
/// The flag can be overridden with --no-hidden.
|
/// The flag can be overridden with --no-hidden.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -46,7 +48,8 @@ pub struct Opts {
|
||||||
no_hidden: (),
|
no_hidden: (),
|
||||||
|
|
||||||
/// Show search results from files and directories that would otherwise be
|
/// Show search results from files and directories that would otherwise be
|
||||||
/// ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.
|
/// ignored by '.gitignore', '.ignore', '.fdignore', the global ignore file,
|
||||||
|
/// or the rule to exclude .git/.
|
||||||
/// The flag can be overridden with --ignore.
|
/// The flag can be overridden with --ignore.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
|
@ -61,7 +64,8 @@ pub struct Opts {
|
||||||
ignore: (),
|
ignore: (),
|
||||||
|
|
||||||
///Show search results from files and directories that would otherwise be
|
///Show search results from files and directories that would otherwise be
|
||||||
/// ignored by '.gitignore' files. The flag can be overridden with --ignore-vcs.
|
/// ignored by '.gitignore' files or the rule to exclude .git/.
|
||||||
|
/// The flag can be overridden with --ignore-vcs.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
hide_short_help = true,
|
hide_short_help = true,
|
||||||
|
|
|
@ -69,7 +69,7 @@ pub fn scan(paths: &[PathBuf], patterns: Arc<Vec<Regex>>, config: Arc<Config>) -
|
||||||
|
|
||||||
if config.read_vcsignore {
|
if config.read_vcsignore {
|
||||||
override_builder
|
override_builder
|
||||||
.add("!.git")
|
.add("!.git/")
|
||||||
.expect("Invalid exclude pattern");
|
.expect("Invalid exclude pattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user