3 test_description
='test re-include patterns'
7 test_expect_success
'setup' '
8 mkdir -p fooo foo/bar tmp &&
9 touch abc foo/def foo/bar/ghi foo/bar/bar
12 test_expect_success
'no match, do not enter subdir and waste cycles' '
13 cat >.gitignore <<-\EOF &&
18 GIT_TRACE_EXCLUDE="$(pwd)/tmp/trace" git ls-files -o --exclude-standard >tmp/actual &&
19 ! grep "enter .foo/.\$" tmp/trace &&
20 cat >tmp/expected <<-\EOF &&
24 test_cmp tmp/expected tmp/actual
27 test_expect_success
'match, excluded by literal pathname pattern' '
28 cat >.gitignore <<-\EOF &&
34 cat >fooo/.gitignore <<-\EOF &&
36 EOF git ls-files -o --exclude-standard >tmp/actual &&
37 cat >tmp/expected <<-\EOF &&
42 test_cmp tmp/expected tmp/actual
45 test_expect_success
'match, excluded by wildcard pathname pattern' '
46 cat >.gitignore <<-\EOF &&
52 git ls-files -o --exclude-standard >tmp/actual &&
53 cat >tmp/expected <<-\EOF &&
58 test_cmp tmp/expected tmp/actual
61 test_expect_success
'match, excluded by literal basename pattern' '
62 cat >.gitignore <<-\EOF &&
68 git ls-files -o --exclude-standard >tmp/actual &&
69 cat >tmp/expected <<-\EOF &&
74 test_cmp tmp/expected tmp/actual
77 test_expect_success
'match, excluded by wildcard basename pattern' '
78 cat >.gitignore <<-\EOF &&
84 git ls-files -o --exclude-standard >tmp/actual &&
85 cat >tmp/expected <<-\EOF &&
90 test_cmp tmp/expected tmp/actual
93 test_expect_success
'match, excluded by literal mustbedir, basename pattern' '
94 cat >.gitignore <<-\EOF &&
100 git ls-files -o --exclude-standard >tmp/actual &&
101 cat >tmp/expected <<-\EOF &&
106 test_cmp tmp/expected tmp/actual
109 test_expect_success
'match, excluded by literal mustbedir, pathname pattern' '
110 cat >.gitignore <<-\EOF &&
116 git ls-files -o --exclude-standard >tmp/actual &&
117 cat >tmp/expected <<-\EOF &&
122 test_cmp tmp/expected tmp/actual
125 test_expect_success
'prepare for nested negatives' '
126 cat >.git/info/exclude <<-\EOF &&
132 git ls-files -o --exclude-standard >tmp/actual &&
133 test_must_be_empty tmp/actual &&
135 touch 1/f 1/2/f 1/2/3/f 1/2/3/4/f
138 test_expect_success
'match, literal pathname, nested negatives' '
139 cat >.gitignore <<-\EOF &&
145 git ls-files -o --exclude-standard >tmp/actual &&
146 cat >tmp/expected <<-\EOF &&
150 test_cmp tmp/expected tmp/actual