From 08c42d7e79549e6ddb5ca6bc81152c9a33d4bb99 Mon Sep 17 00:00:00 2001 From: Axel Dahlberg Date: Thu, 26 Dec 2024 04:17:50 -0800 Subject: [PATCH] feat: adds (no-)ignore-vsc-exclude --- src/cli.rs | 16 ++++++++++++++++ src/config.rs | 3 +++ src/main.rs | 4 ++++ src/walk.rs | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index b45ef12dc..e41c2e6f8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -78,6 +78,22 @@ pub struct Opts { #[arg(long, overrides_with = "no_ignore_vcs", hide = true, action = ArgAction::SetTrue)] ignore_vcs: (), + ///Show search results from files and directories that + ///would otherwise be ignored by '.git/info/exclude'. + ///Git ignore files are still respected unless --no-ignore-vsc is given. + ///The flag can be overridden with --ignore-vcs. + #[arg( + long, + hide_short_help = true, + help = "Do not respect .git/info/exclude", + long_help + )] + pub no_ignore_vcs_exclude: bool, + + /// Overrides --no-ignore-vcs-exclude + #[arg(long, overrides_with = "no_ignore_vcs_exclude", hide = true, action = ArgAction::SetTrue)] + ignore_vcs_exclude: (), + /// Do not require a git repository to respect gitignores. /// By default, fd will only respect global gitignore rules, .gitignore rules, /// and local exclude rules if fd detects that you are searching inside a diff --git a/src/config.rs b/src/config.rs index 9e18120c4..b43063994 100644 --- a/src/config.rs +++ b/src/config.rs @@ -31,6 +31,9 @@ pub struct Config { /// Whether to respect VCS ignore files (`.gitignore`, ..) or not. pub read_vcsignore: bool, + /// Whether to respect VCS exclude files (`.git/info/exclude`, ..) or not. + pub read_vcsexclude: bool, + /// Whether to require a `.git` directory to respect gitignore files. pub require_git_to_read_vcsignore: bool, diff --git a/src/main.rs b/src/main.rs index d275b2aff..b3f0e26e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -249,6 +249,10 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result