From 8f6a1b71156f59bdc995485e50edd1df1a3757cf Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Sun, 22 Oct 2023 02:00:44 -0600 Subject: [PATCH] tests: Add tests for ignoring .git/ --- tests/tests.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/tests.rs b/tests/tests.rs index daad76f..627570f 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -2554,3 +2554,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", + ); +}