Skip to content
Myr

Fix logic for --no-ignore-parent (#908)

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

Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it continues to respect .fdignore and .ignore in the parent directories.

authored by Thayne McCombs · committed by GitHub · parent 81669f4 · Browse files · 3 files+18 added−5 removed
This commit

State

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

Trailers

  • Fixes: #907
  • Fixes: #901

Diff stats

3 files+18 added−5 removed

  • tests:+16 added−0 removed
  • other:+2 added−5 removed

3 files+18 added−5 removed

modified:src/main.rs+1 added-4 removed
258 unmodified lines
259 || matches.is_present("rg-alias-hidden-ignore")),260 read_vcsignore: !(matches.is_present("no-ignore")261 || matches.is_present("rg-alias-hidden-ignore")262 || matches.is_present("no-ignore-vcs")),263 read_parent_ignore: !(matches.is_present("no-ignore")264 || matches.is_present("rg-alias-hidden-ignore")265 || matches.is_present("no-ignore-vcs")266 || matches.is_present("no-ignore-parent")),263 read_parent_ignore: !matches.is_present("no-ignore-parent"),264 read_global_ignore: !(matches.is_present("no-ignore")265 || matches.is_present("rg-alias-hidden-ignore")266 || matches.is_present("no-global-ignore-file")),267 follow_links: matches.is_present("follow"),
299 unmodified lines
modified:src/walk.rs+1 added-1 removed
70 unmodified lines
71 let mut walker = WalkBuilder::new(first_path_buf.as_path());72 walker73 .hidden(config.ignore_hidden)74 .ignore(config.read_fdignore)75 .parents(config.read_parent_ignore)75 .parents(config.read_parent_ignore && (config.read_fdignore || config.read_vcsignore))76 .git_ignore(config.read_vcsignore)77 .git_global(config.read_vcsignore)78 .git_exclude(config.read_vcsignore)79 .overrides(overrides)
548 unmodified lines
modified:tests/tests.rs+16 added
612 unmodified lines
613 ./one/two/three/directory_foo",614 );615}616617/// Test that --no-ignore-vcs still respects .fdignored in parent directory618#[test]619fn test_no_ignore_vcs_child_dir() {620 let te = TestEnv::new(621 &["inner"],622 &["inner/fdignored.foo", "inner/foo", "inner/gitignored.foo"],623 );624625 te.assert_output_subdirectory(626 "inner",627 &["--no-ignore-vcs", "foo"],628 "./foo629 ./gitignored.foo",630 );631}632633/// Custom ignore files (--ignore-file)634#[test]635fn test_custom_ignore_files() {636 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
1382 unmodified lines