cli: add --no-ignore-exclude flag
This commit adds a new --no-ignore-exclude flag that permits disabling the use of .git/info/exclude filtering. Local exclusions are manual configurations to a repository and are not shared, so it is sometimes useful to disable to get a consistent view of a repository. This also adds a new section to the man page that describes automatic filtering. Closes #1420
This commit is contained in:
committed by
Andrew Gallant
parent
804b43ecd8
commit
297b428c8c
21
src/app.rs
21
src/app.rs
@@ -595,6 +595,7 @@ pub fn all_args_and_flags() -> Vec<RGArg> {
|
||||
flag_no_config(&mut args);
|
||||
flag_no_ignore(&mut args);
|
||||
flag_no_ignore_dot(&mut args);
|
||||
flag_no_ignore_exclude(&mut args);
|
||||
flag_no_ignore_global(&mut args);
|
||||
flag_no_ignore_messages(&mut args);
|
||||
flag_no_ignore_parent(&mut args);
|
||||
@@ -1769,6 +1770,26 @@ This flag can be disabled with the --ignore-dot flag.
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
fn flag_no_ignore_exclude(args: &mut Vec<RGArg>) {
|
||||
const SHORT: &str = "Don't respect local exclusion files.";
|
||||
const LONG: &str = long!("\
|
||||
Don't respect ignore files that are manually configured for the repository
|
||||
such as git's '.git/info/exclude'.
|
||||
|
||||
This flag can be disabled with the --ignore-exclude flag.
|
||||
");
|
||||
let arg = RGArg::switch("no-ignore-exclude")
|
||||
.help(SHORT).long_help(LONG)
|
||||
.overrides("ignore-exclude");
|
||||
args.push(arg);
|
||||
|
||||
let arg = RGArg::switch("ignore-exclude")
|
||||
.hidden()
|
||||
.overrides("no-ignore-exclude");
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
|
||||
fn flag_no_ignore_global(args: &mut Vec<RGArg>) {
|
||||
const SHORT: &str = "Don't respect global ignore files.";
|
||||
const LONG: &str = long!("\
|
||||
|
||||
@@ -881,7 +881,7 @@ impl ArgMatches {
|
||||
.ignore(!self.no_ignore_dot())
|
||||
.git_global(!self.no_ignore_vcs() && !self.no_ignore_global())
|
||||
.git_ignore(!self.no_ignore_vcs())
|
||||
.git_exclude(!self.no_ignore_vcs())
|
||||
.git_exclude(!self.no_ignore_vcs() && !self.no_ignore_exclude())
|
||||
.ignore_case_insensitive(self.ignore_file_case_insensitive());
|
||||
if !self.no_ignore() {
|
||||
builder.add_custom_ignore_filename(".rgignore");
|
||||
@@ -1231,6 +1231,11 @@ impl ArgMatches {
|
||||
self.is_present("no-ignore-dot") || self.no_ignore()
|
||||
}
|
||||
|
||||
/// Returns true if local exclude (ignore) files should be ignored.
|
||||
fn no_ignore_exclude(&self) -> bool {
|
||||
self.is_present("no-ignore-exclude") || self.no_ignore()
|
||||
}
|
||||
|
||||
/// Returns true if global ignore files should be ignored.
|
||||
fn no_ignore_global(&self) -> bool {
|
||||
self.is_present("no-ignore-global") || self.no_ignore()
|
||||
|
||||
Reference in New Issue
Block a user