3 test_description='git-status ignored files'
15 test_expect_success 'status untracked directory with --ignored' '
16 echo "ignored" >.gitignore &&
18 : >untracked/ignored &&
19 : >untracked/uncommitted &&
20 git status --porcelain --ignored >actual &&
21 test_cmp expected actual
24 test_expect_success 'same with gitignore starting with BOM' '
25 printf "\357\273\277ignored\n" >.gitignore &&
27 : >untracked/ignored &&
28 : >untracked/uncommitted &&
29 git status --porcelain --ignored >actual &&
30 test_cmp expected actual
33 test_expect_success 'status untracked files --ignored with pathspec (no match)' '
34 git status --porcelain --ignored -- untracked/i >actual &&
35 test_must_be_empty actual &&
36 git status --porcelain --ignored -- untracked/u >actual &&
37 test_must_be_empty actual
40 test_expect_success 'status untracked files --ignored with pathspec (literal match)' '
41 git status --porcelain --ignored -- untracked/ignored >actual &&
42 echo "!! untracked/ignored" >expected &&
43 test_cmp expected actual &&
44 git status --porcelain --ignored -- untracked/uncommitted >actual &&
45 echo "?? untracked/uncommitted" >expected &&
46 test_cmp expected actual
49 test_expect_success 'status untracked files --ignored with pathspec (glob match)' '
50 git status --porcelain --ignored -- untracked/i\* >actual &&
51 echo "!! untracked/ignored" >expected &&
52 test_cmp expected actual &&
53 git status --porcelain --ignored -- untracked/u\* >actual &&
54 echo "?? untracked/uncommitted" >expected &&
55 test_cmp expected actual
62 ?? untracked/uncommitted
66 test_expect_success 'status untracked directory with --ignored -u' '
67 git status --porcelain --ignored -u >actual &&
68 test_cmp expected actual
75 test_expect_success 'status of untracked directory with --ignored works with or without prefix' '
76 git status --porcelain --ignored >tmp &&
77 grep untracked/ tmp >actual &&
79 test_cmp expected actual &&
81 git status --porcelain --ignored untracked/ >actual &&
82 test_cmp expected actual
86 ?? untracked/uncommitted
90 test_expect_success 'status prefixed untracked sub-directory with --ignored -u' '
91 git status --porcelain --ignored -u untracked/ >actual &&
92 test_cmp expected actual
102 test_expect_success 'status ignored directory with --ignore' '
105 : >ignored/uncommitted &&
106 git status --porcelain --ignored >actual &&
107 test_cmp expected actual
114 !! ignored/uncommitted
117 test_expect_success 'status ignored directory with --ignore -u' '
118 git status --porcelain --ignored -u >actual &&
119 test_cmp expected actual
128 test_expect_success 'status empty untracked directory with --ignore' '
130 mkdir untracked-ignored &&
131 mkdir untracked-ignored/test &&
132 git status --porcelain --ignored >actual &&
133 test_cmp expected actual
142 test_expect_success 'status empty untracked directory with --ignore -u' '
143 git status --porcelain --ignored -u >actual &&
144 test_cmp expected actual
151 !! untracked-ignored/
154 test_expect_success 'status untracked directory with ignored files with --ignore' '
155 : >untracked-ignored/ignored &&
156 : >untracked-ignored/test/ignored &&
157 git status --porcelain --ignored >actual &&
158 test_cmp expected actual
165 !! untracked-ignored/ignored
166 !! untracked-ignored/test/ignored
169 test_expect_success 'status untracked directory with ignored files with --ignore -u' '
170 git status --porcelain --ignored -u >actual &&
171 test_cmp expected actual
180 test_expect_success 'status ignored tracked directory with --ignore' '
181 rm -rf untracked-ignored &&
183 : >tracked/committed &&
184 git add tracked/committed &&
186 echo "tracked" >.gitignore &&
187 git status --porcelain --ignored >actual &&
188 test_cmp expected actual
197 test_expect_success 'status ignored tracked directory with --ignore -u' '
198 git status --porcelain --ignored -u >actual &&
199 test_cmp expected actual
208 test_expect_success 'status ignored tracked directory and ignored file with --ignore' '
209 echo "committed" >>.gitignore &&
210 git status --porcelain --ignored >actual &&
211 test_cmp expected actual
220 test_expect_success 'status ignored tracked directory and ignored file with --ignore -u' '
221 git status --porcelain --ignored -u >actual &&
222 test_cmp expected actual
229 !! tracked/uncommitted
232 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' '
233 echo "tracked" >.gitignore &&
234 : >tracked/uncommitted &&
235 git status --porcelain --ignored >actual &&
236 test_cmp expected actual
243 !! tracked/uncommitted
246 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore -u' '
247 git status --porcelain --ignored -u >actual &&
248 test_cmp expected actual
258 test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore' '
259 rm -rf tracked/uncommitted &&
260 mkdir tracked/ignored &&
261 : >tracked/ignored/uncommitted &&
262 git status --porcelain --ignored >actual &&
263 test_cmp expected actual
270 !! tracked/ignored/uncommitted
273 test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore -u' '
274 git status --porcelain --ignored -u >actual &&
275 test_cmp expected actual
282 !! tracked/ignored/uncommitted
285 test_expect_success 'status ignored tracked directory with uncommitted file in tracked subdir with --ignore' '
286 : >tracked/ignored/committed &&
287 git add -f tracked/ignored/committed &&
289 git status --porcelain --ignored >actual &&
290 test_cmp expected actual
297 !! tracked/ignored/uncommitted
300 test_expect_success 'status ignored tracked directory with uncommitted file in tracked subdir with --ignore -u' '
301 git status --porcelain --ignored -u >actual &&
302 test_cmp expected actual
306 !! tracked/submodule/
309 test_expect_success 'status ignores submodule in excluded directory' '
310 git init tracked/submodule &&
311 test_commit -C tracked/submodule initial &&
312 git status --porcelain --ignored -u tracked/submodule >actual &&
313 test_cmp expected actual