tests: Add tests for ignoring .git/

This commit is contained in:
Thayne McCombs 2023-10-22 02:00:44 -06:00 committed by David Peter
parent 53fd416c47
commit 8897659607
1 changed files with 24 additions and 0 deletions

View File

@ -2556,3 +2556,27 @@ fn test_invalid_cwd() {
panic!("{:?}", output);
}
}
/// Test behavior of .git directory with various flags
#[test]
fn test_git_dir() {
let te = TestEnv::new(
&[".git/one"],
&[".git/one/foo.a", ".git/.foo", ".git/a.foo"],
);
te.assert_output(&["--hidden", "foo"], "");
te.assert_output(&["--no-ignore", "foo"], "");
te.assert_output(
&["--hidden", "--no-ignore", "foo"],
".git/one/foo.a
.git/.foo
.git/a.foo",
);
te.assert_output(
&["--hidden", "--no-ignore-vcs", "foo"],
".git/one/foo.a
.git/.foo
.git/a.foo",
);
}