diff --git a/src/main.rs b/src/main.rs index 4f4ab14..56d6bfb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -260,10 +260,7 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result, config: Arc) -> R walker .hidden(config.ignore_hidden) .ignore(config.read_fdignore) - .parents(config.read_parent_ignore) + .parents(config.read_parent_ignore && (config.read_fdignore || config.read_vcsignore)) .git_ignore(config.read_vcsignore) .git_global(config.read_vcsignore) .git_exclude(config.read_vcsignore) diff --git a/tests/tests.rs b/tests/tests.rs index 807b91b..e6cee6c 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -614,6 +614,22 @@ fn test_no_ignore_vcs() { ); } +/// Test that --no-ignore-vcs still respects .fdignored in parent directory +#[test] +fn test_no_ignore_vcs_child_dir() { + let te = TestEnv::new( + &["inner"], + &["inner/fdignored.foo", "inner/foo", "inner/gitignored.foo"], + ); + + te.assert_output_subdirectory( + "inner", + &["--no-ignore-vcs", "foo"], + "./foo + ./gitignored.foo", + ); +} + /// Custom ignore files (--ignore-file) #[test] fn test_custom_ignore_files() {