mirror of
https://github.com/sharkdp/fd.git
synced 2024-09-28 21:11:30 +02:00
parent
8eb047945e
commit
e10a4eab2b
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
- Add `dir` as an alias to `directory` when using `-t` \ `--type`, see #1460 and #1464 (@Ato2207).
|
- Add `dir` as an alias to `directory` when using `-t` \ `--type`, see #1460 and #1464 (@Ato2207).
|
||||||
- Add support for @%s date format in time filters similar to GNU date (seconds since Unix epoch for --older/--newer), see #1493 (@nabellows)
|
- Add support for @%s date format in time filters similar to GNU date (seconds since Unix epoch for --older/--newer), see #1493 (@nabellows)
|
||||||
|
- Breaking: No longer automatically ignore `.git` when using `--hidden` with vcs ignore enabled. This reverts the change in v9.0.0. While this feature
|
||||||
|
was often useful, it also broke some existing workflows, and there wasn't a good way to opt out of it. And there isn't really a good way for us to add
|
||||||
|
a way to opt out of it. And you can easily get similar behavior by adding `.git/` to your global fdignore file.
|
||||||
|
See #1457.
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
|
@ -282,6 +282,9 @@ If you want `fd` to ignore these patterns globally, you can put them in `fd`'s g
|
|||||||
This is usually located in `~/.config/fd/ignore` in macOS or Linux, and `%APPDATA%\fd\ignore` in
|
This is usually located in `~/.config/fd/ignore` in macOS or Linux, and `%APPDATA%\fd\ignore` in
|
||||||
Windows.
|
Windows.
|
||||||
|
|
||||||
|
You may wish to include `.git/` in your `fd/ignore` file so that `.git` directories, and their contents
|
||||||
|
are not included in output if you use the `--hidden` option.
|
||||||
|
|
||||||
### Deleting files
|
### Deleting files
|
||||||
|
|
||||||
You can use `fd` to remove all files and directories that are matched by your search pattern.
|
You can use `fd` to remove all files and directories that are matched by your search pattern.
|
||||||
|
28
doc/fd.1
vendored
28
doc/fd.1
vendored
@ -33,16 +33,14 @@ with the '\-\-glob' option.
|
|||||||
By default
|
By default
|
||||||
.B fd
|
.B fd
|
||||||
will exclude hidden files and directories, as well as any files that match gitignore rules
|
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
|
or ignore rules in .ignore or .fdignore files.
|
||||||
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
|
.IP
|
||||||
Ignored files and .git/ are still excluded unless \-\-no\-ignore or \-\-no\-ignore\-vcs
|
Ignored files are still excluded unless \-\-no\-ignore or \-\-no\-ignore\-vcs
|
||||||
is also used.
|
is also used.
|
||||||
.TP
|
.TP
|
||||||
.B \-I, \-\-no\-ignore
|
.B \-I, \-\-no\-ignore
|
||||||
@ -79,7 +77,6 @@ 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
|
||||||
@ -494,6 +491,17 @@ is set, use
|
|||||||
.IR $XDG_CONFIG_HOME/fd/ignore .
|
.IR $XDG_CONFIG_HOME/fd/ignore .
|
||||||
Otherwise, use
|
Otherwise, use
|
||||||
.IR $HOME/.config/fd/ignore .
|
.IR $HOME/.config/fd/ignore .
|
||||||
|
.SH FILES
|
||||||
|
.TP
|
||||||
|
.B .fdignore
|
||||||
|
This file works similarly to a .gitignore file anywhere in the searched tree and specifies patterns
|
||||||
|
that should be excluded from the search. However, this file is specific to fd, and will be used even
|
||||||
|
if the --no-ignore-vcs option is used.
|
||||||
|
.TP
|
||||||
|
.B $XDG_CONFIG_HOME/fd/ignore
|
||||||
|
Global ignore file. Unless ignore mode is turned off (such as with --no-ignore)
|
||||||
|
ignore entries in this file will be ignored, as if it was an .fdignore file in the
|
||||||
|
current directory.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
.RI "Find files and directories that match the pattern '" needle "':"
|
.RI "Find files and directories that match the pattern '" needle "':"
|
||||||
@ -507,6 +515,16 @@ $ fd -e py
|
|||||||
.TP
|
.TP
|
||||||
.RI "Open all search results with vim:"
|
.RI "Open all search results with vim:"
|
||||||
$ fd pattern -X vim
|
$ fd pattern -X vim
|
||||||
|
.SH Tips and Tricks
|
||||||
|
.IP \[bu]
|
||||||
|
If you add ".git/" to your global ignore file ($XDG_CONFIG_HOME/fd/ignore), then
|
||||||
|
".git" folders will be ignored by default, even when the --hidden option is used.
|
||||||
|
.IP \[bu]
|
||||||
|
You can use a shell alias or a wrapper script in order to pass desired flags to fd
|
||||||
|
by default. For example if you do not like the default behavior of respecting gitignore,
|
||||||
|
you can use
|
||||||
|
`alias fd="/usr/bin/fd --no-ignore-vcs"`
|
||||||
|
in your .bashrc to create an alias for fd that doesn't ignore git files by default.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues
|
Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
@ -49,8 +49,7 @@ 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', the global ignore file,
|
/// ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file,
|
||||||
/// or the default rule that excludes .git/.
|
|
||||||
/// The flag can be overridden with --ignore.
|
/// The flag can be overridden with --ignore.
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
@ -64,7 +63,7 @@ pub struct Opts {
|
|||||||
#[arg(long, overrides_with = "no_ignore", hide = true, action = ArgAction::SetTrue)]
|
#[arg(long, overrides_with = "no_ignore", hide = true, action = ArgAction::SetTrue)]
|
||||||
ignore: (),
|
ignore: (),
|
||||||
|
|
||||||
///Show search results from '.git/' folders and files and directories that
|
///Show search results from files and directories that
|
||||||
///would otherwise be ignored by '.gitignore' files.
|
///would otherwise be ignored by '.gitignore' files.
|
||||||
///The flag can be overridden with --ignore-vcs.
|
///The flag can be overridden with --ignore-vcs.
|
||||||
#[arg(
|
#[arg(
|
||||||
|
@ -334,10 +334,6 @@ impl WorkerState {
|
|||||||
.map_err(|e| anyhow!("Malformed exclude pattern: {}", e))?;
|
.map_err(|e| anyhow!("Malformed exclude pattern: {}", e))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.read_vcsignore {
|
|
||||||
builder.add("!.git/").expect("Invalid exclude pattern");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.build()
|
.build()
|
||||||
.map_err(|_| anyhow!("Mismatch in exclude patterns"))
|
.map_err(|_| anyhow!("Mismatch in exclude patterns"))
|
||||||
|
@ -2573,7 +2573,14 @@ fn test_git_dir() {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
te.assert_output(&["--hidden", "foo"], "");
|
te.assert_output(
|
||||||
|
&["--hidden", "foo"],
|
||||||
|
".git/one/foo.a
|
||||||
|
.git/.foo
|
||||||
|
.git/a.foo
|
||||||
|
other_dir/.git/foo1
|
||||||
|
nested/dir/.git/foo2",
|
||||||
|
);
|
||||||
te.assert_output(&["--no-ignore", "foo"], "");
|
te.assert_output(&["--no-ignore", "foo"], "");
|
||||||
te.assert_output(
|
te.assert_output(
|
||||||
&["--hidden", "--no-ignore", "foo"],
|
&["--hidden", "--no-ignore", "foo"],
|
||||||
|
Loading…
Reference in New Issue
Block a user