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
37 ?? untracked
/uncommitted
41 test_expect_success
'status untracked directory with --ignored -u' '
42 git status --porcelain --ignored -u >actual &&
43 test_cmp expected actual
50 test_expect_success
'status of untracked directory with --ignored works with or without prefix' '
51 git status --porcelain --ignored >tmp &&
52 grep untracked/ tmp >actual &&
54 test_cmp expected actual &&
56 git status --porcelain --ignored untracked/ >actual &&
57 test_cmp expected actual
61 ?? untracked
/uncommitted
65 test_expect_success
'status prefixed untracked sub-directory with --ignored -u' '
66 git status --porcelain --ignored -u untracked/ >actual &&
67 test_cmp expected actual
77 test_expect_success
'status ignored directory with --ignore' '
80 : >ignored/uncommitted &&
81 git status --porcelain --ignored >actual &&
82 test_cmp expected actual
89 !! ignored
/uncommitted
92 test_expect_success
'status ignored directory with --ignore -u' '
93 git status --porcelain --ignored -u >actual &&
94 test_cmp expected actual
103 test_expect_success
'status empty untracked directory with --ignore' '
105 mkdir untracked-ignored &&
106 mkdir untracked-ignored/test &&
107 git status --porcelain --ignored >actual &&
108 test_cmp expected actual
117 test_expect_success
'status empty untracked directory with --ignore -u' '
118 git status --porcelain --ignored -u >actual &&
119 test_cmp expected actual
126 !! untracked-ignored
/
129 test_expect_success
'status untracked directory with ignored files with --ignore' '
130 : >untracked-ignored/ignored &&
131 : >untracked-ignored/test/ignored &&
132 git status --porcelain --ignored >actual &&
133 test_cmp expected actual
140 !! untracked-ignored
/ignored
141 !! untracked-ignored
/test
/ignored
144 test_expect_success
'status untracked directory with ignored files with --ignore -u' '
145 git status --porcelain --ignored -u >actual &&
146 test_cmp expected actual
155 test_expect_success
'status ignored tracked directory with --ignore' '
156 rm -rf untracked-ignored &&
158 : >tracked/committed &&
159 git add tracked/committed &&
161 echo "tracked" >.gitignore &&
162 git status --porcelain --ignored >actual &&
163 test_cmp expected actual
172 test_expect_success
'status ignored tracked directory with --ignore -u' '
173 git status --porcelain --ignored -u >actual &&
174 test_cmp expected actual
183 test_expect_success
'status ignored tracked directory and ignored file with --ignore' '
184 echo "committed" >>.gitignore &&
185 git status --porcelain --ignored >actual &&
186 test_cmp expected actual
195 test_expect_success
'status ignored tracked directory and ignored file with --ignore -u' '
196 git status --porcelain --ignored -u >actual &&
197 test_cmp expected actual
204 !! tracked
/uncommitted
207 test_expect_success
'status ignored tracked directory and uncommitted file with --ignore' '
208 echo "tracked" >.gitignore &&
209 : >tracked/uncommitted &&
210 git status --porcelain --ignored >actual &&
211 test_cmp expected actual
218 !! tracked
/uncommitted
221 test_expect_success
'status ignored tracked directory and uncommitted file with --ignore -u' '
222 git status --porcelain --ignored -u >actual &&
223 test_cmp expected actual
233 test_expect_success
'status ignored tracked directory with uncommitted file in untracked subdir with --ignore' '
234 rm -rf tracked/uncommitted &&
235 mkdir tracked/ignored &&
236 : >tracked/ignored/uncommitted &&
237 git status --porcelain --ignored >actual &&
238 test_cmp expected actual
245 !! tracked
/ignored
/uncommitted
248 test_expect_success
'status ignored tracked directory with uncommitted file in untracked subdir with --ignore -u' '
249 git status --porcelain --ignored -u >actual &&
250 test_cmp expected actual
257 !! tracked
/ignored
/uncommitted
260 test_expect_success
'status ignored tracked directory with uncommitted file in tracked subdir with --ignore' '
261 : >tracked/ignored/committed &&
262 git add -f tracked/ignored/committed &&
264 git status --porcelain --ignored >actual &&
265 test_cmp expected actual
272 !! tracked
/ignored
/uncommitted
275 test_expect_success
'status ignored tracked directory with uncommitted file in tracked subdir with --ignore -u' '
276 git status --porcelain --ignored -u >actual &&
277 test_cmp expected actual
281 !! tracked
/submodule
/
284 test_expect_success
'status ignores submodule in excluded directory' '
285 git init tracked/submodule &&
286 test_commit -C tracked/submodule initial &&
287 git status --porcelain --ignored -u tracked/submodule >actual &&
288 test_cmp expected actual