Skip to content
Myr

Make -u idempotent

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jackson Theel · committed by David Peter · parent 306cd99 · Browse files · 3 files+6 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+6 added−18 removed

  • tests:+1 added−13 removed
  • other:+5 added−5 removed

3 files+6 added−18 removed

modified:src/app.rs+4 added-4 removed
100 unmodified lines
101 Arg::new("rg-alias-hidden-ignore")102 .short('u')103 .long("unrestricted")104 .overrides_with_all(&["ignore", "no-hidden"])105 .multiple_occurrences(true)105 .multiple_occurrences(true) // Allowed for historical reasons106 .hide_short_help(true)107 .help("Alias for '--no-ignore', and '--hidden' when given twice")107 .help("Alias for '--no-ignore', and '--hidden'")108 .long_help(109 "Alias for '--no-ignore'. Can be repeated. '-uu' is an alias for \110 '--no-ignore --hidden'.",109 "Perform a search with no filters applied. Unfilters ignored \110 files and hidden files.",111 ),112 )113 .arg(114 Arg::new("case-sensitive")
658 unmodified lines
modified:src/main.rs+1 added-1 removed
254 unmodified lines
255 Ok(Config {256 case_sensitive,257 search_full_path: matches.is_present("full-path"),258 ignore_hidden: !(matches.is_present("hidden")259 || matches.occurrences_of("rg-alias-hidden-ignore") >= 2),259 || matches.is_present("rg-alias-hidden-ignore")),260 read_fdignore: !(matches.is_present("no-ignore")261 || matches.is_present("rg-alias-hidden-ignore")),262 read_vcsignore: !(matches.is_present("no-ignore")263 || matches.is_present("rg-alias-hidden-ignore")
301 unmodified lines
modified:tests/tests.rs+1 added-13 removed
654 unmodified lines
655 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);656657 te.assert_output(658 &["-u", "foo"],659 "./a.foo660 ./fdignored.foo661 ./gitignored.foo662 ./one/b.foo663 ./one/two/c.foo664 ./one/two/C.Foo2665 ./one/two/three/d.foo666 ./one/two/three/directory_foo",667 );668669 te.assert_output(670 &["-uu", "foo"],659 "./.hidden.foo660 ./a.foo661 ./fdignored.foo662 ./gitignored.foo
1363 unmodified lines
2026#[test_case("--no-ignore", &["--ignore"] ; "no-ignore")]2027#[test_case("--no-ignore-vcs", &["--ignore-vcs"] ; "no-ignore-vcs")]2028#[test_case("--follow", &["--no-follow"] ; "follow")]2029#[test_case("--absolute-path", &["--relative-path"] ; "absolute-path")]2042#[test_case("-u", &["--ignore"] ; "u")]2030#[test_case("-u", &["--ignore", "--no-hidden"] ; "u")]2031#[test_case("-uu", &["--ignore", "--no-hidden"] ; "uu")]2032fn test_opposing(flag: &str, opposing_flags: &[&str]) {2033 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);2034
48 unmodified lines