diff options
Diffstat (limited to 't/t0008-ignores.sh')
-rwxr-xr-x | t/t0008-ignores.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh index a594b4aa7d..42d2314804 100755 --- a/t/t0008-ignores.sh +++ b/t/t0008-ignores.sh @@ -2,6 +2,7 @@ test_description=check-ignore +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh init_vars () { @@ -802,6 +803,49 @@ test_expect_success 'existing directory and file' ' grep top-level-dir actual ' +test_expect_success 'exact prefix matching (with root)' ' + test_when_finished rm -r a && + mkdir -p a/git a/git-foo && + touch a/git/foo a/git-foo/bar && + echo /git/ >a/.gitignore && + git check-ignore a/git a/git/foo a/git-foo a/git-foo/bar >actual && + cat >expect <<-\EOF && + a/git + a/git/foo + EOF + test_cmp expect actual +' + +test_expect_success 'exact prefix matching (without root)' ' + test_when_finished rm -r a && + mkdir -p a/git a/git-foo && + touch a/git/foo a/git-foo/bar && + echo git/ >a/.gitignore && + git check-ignore a/git a/git/foo a/git-foo a/git-foo/bar >actual && + cat >expect <<-\EOF && + a/git + a/git/foo + EOF + test_cmp expect actual +' + +test_expect_success 'directories and ** matches' ' + cat >.gitignore <<-\EOF && + data/** + !data/**/ + !data/**/*.txt + EOF + git check-ignore file \ + data/file data/data1/file1 data/data1/file1.txt \ + data/data2/file2 data/data2/file2.txt >actual && + cat >expect <<-\EOF && + data/file + data/data1/file1 + data/data2/file2 + EOF + test_cmp expect actual +' + ############################################################################ # # test whitespace handling |