Merge branch 'ew/daemon-socket-keepalive' into maint
[git.git] / t / t7061-wtstatus-ignore.sh
blobcdc0747bf01b0598a2e864073887896162815019
1 #!/bin/sh
3 test_description='git-status ignored files'
5 . ./test-lib.sh
7 cat >expected <<\EOF
8 ?? .gitignore
9 ?? actual
10 ?? expected
11 ?? untracked/
12 EOF
14 test_expect_success 'status untracked directory with --ignored' '
15 echo "ignored" >.gitignore &&
16 mkdir untracked &&
17 : >untracked/ignored &&
18 : >untracked/uncommitted &&
19 git status --porcelain --ignored >actual &&
20 test_cmp expected actual
23 test_expect_success 'same with gitignore starting with BOM' '
24 printf "\357\273\277ignored\n" >.gitignore &&
25 mkdir -p untracked &&
26 : >untracked/ignored &&
27 : >untracked/uncommitted &&
28 git status --porcelain --ignored >actual &&
29 test_cmp expected actual
32 cat >expected <<\EOF
33 ?? .gitignore
34 ?? actual
35 ?? expected
36 ?? untracked/uncommitted
37 !! untracked/ignored
38 EOF
40 test_expect_success 'status untracked directory with --ignored -u' '
41 git status --porcelain --ignored -u >actual &&
42 test_cmp expected actual
44 cat >expected <<\EOF
45 ?? untracked/uncommitted
46 !! untracked/ignored
47 EOF
49 test_expect_success 'status prefixed untracked directory with --ignored' '
50 git status --porcelain --ignored untracked/ >actual &&
51 test_cmp expected actual
54 cat >expected <<\EOF
55 ?? untracked/uncommitted
56 !! untracked/ignored
57 EOF
59 test_expect_success 'status prefixed untracked sub-directory with --ignored -u' '
60 git status --porcelain --ignored -u untracked/ >actual &&
61 test_cmp expected actual
64 cat >expected <<\EOF
65 ?? .gitignore
66 ?? actual
67 ?? expected
68 !! ignored/
69 EOF
71 test_expect_success 'status ignored directory with --ignore' '
72 rm -rf untracked &&
73 mkdir ignored &&
74 : >ignored/uncommitted &&
75 git status --porcelain --ignored >actual &&
76 test_cmp expected actual
79 cat >expected <<\EOF
80 ?? .gitignore
81 ?? actual
82 ?? expected
83 !! ignored/uncommitted
84 EOF
86 test_expect_success 'status ignored directory with --ignore -u' '
87 git status --porcelain --ignored -u >actual &&
88 test_cmp expected actual
91 cat >expected <<\EOF
92 ?? .gitignore
93 ?? actual
94 ?? expected
95 EOF
97 test_expect_success 'status empty untracked directory with --ignore' '
98 rm -rf ignored &&
99 mkdir untracked-ignored &&
100 mkdir untracked-ignored/test &&
101 git status --porcelain --ignored >actual &&
102 test_cmp expected actual
105 cat >expected <<\EOF
106 ?? .gitignore
107 ?? actual
108 ?? expected
111 test_expect_success 'status empty untracked directory with --ignore -u' '
112 git status --porcelain --ignored -u >actual &&
113 test_cmp expected actual
116 cat >expected <<\EOF
117 ?? .gitignore
118 ?? actual
119 ?? expected
120 !! untracked-ignored/
123 test_expect_success 'status untracked directory with ignored files with --ignore' '
124 : >untracked-ignored/ignored &&
125 : >untracked-ignored/test/ignored &&
126 git status --porcelain --ignored >actual &&
127 test_cmp expected actual
130 cat >expected <<\EOF
131 ?? .gitignore
132 ?? actual
133 ?? expected
134 !! untracked-ignored/ignored
135 !! untracked-ignored/test/ignored
138 test_expect_success 'status untracked directory with ignored files with --ignore -u' '
139 git status --porcelain --ignored -u >actual &&
140 test_cmp expected actual
143 cat >expected <<\EOF
144 ?? .gitignore
145 ?? actual
146 ?? expected
149 test_expect_success 'status ignored tracked directory with --ignore' '
150 rm -rf untracked-ignored &&
151 mkdir tracked &&
152 : >tracked/committed &&
153 git add tracked/committed &&
154 git commit -m. &&
155 echo "tracked" >.gitignore &&
156 git status --porcelain --ignored >actual &&
157 test_cmp expected actual
160 cat >expected <<\EOF
161 ?? .gitignore
162 ?? actual
163 ?? expected
166 test_expect_success 'status ignored tracked directory with --ignore -u' '
167 git status --porcelain --ignored -u >actual &&
168 test_cmp expected actual
171 cat >expected <<\EOF
172 ?? .gitignore
173 ?? actual
174 ?? expected
177 test_expect_success 'status ignored tracked directory and ignored file with --ignore' '
178 echo "committed" >>.gitignore &&
179 git status --porcelain --ignored >actual &&
180 test_cmp expected actual
183 cat >expected <<\EOF
184 ?? .gitignore
185 ?? actual
186 ?? expected
189 test_expect_success 'status ignored tracked directory and ignored file with --ignore -u' '
190 git status --porcelain --ignored -u >actual &&
191 test_cmp expected actual
194 cat >expected <<\EOF
195 ?? .gitignore
196 ?? actual
197 ?? expected
198 !! tracked/uncommitted
201 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' '
202 echo "tracked" >.gitignore &&
203 : >tracked/uncommitted &&
204 git status --porcelain --ignored >actual &&
205 test_cmp expected actual
208 cat >expected <<\EOF
209 ?? .gitignore
210 ?? actual
211 ?? expected
212 !! tracked/uncommitted
215 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore -u' '
216 git status --porcelain --ignored -u >actual &&
217 test_cmp expected actual
220 cat >expected <<\EOF
221 ?? .gitignore
222 ?? actual
223 ?? expected
224 !! tracked/ignored/
227 test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore' '
228 rm -rf tracked/uncommitted &&
229 mkdir tracked/ignored &&
230 : >tracked/ignored/uncommitted &&
231 git status --porcelain --ignored >actual &&
232 test_cmp expected actual
235 cat >expected <<\EOF
236 ?? .gitignore
237 ?? actual
238 ?? expected
239 !! tracked/ignored/uncommitted
242 test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore -u' '
243 git status --porcelain --ignored -u >actual &&
244 test_cmp expected actual
247 cat >expected <<\EOF
248 ?? .gitignore
249 ?? actual
250 ?? expected
251 !! tracked/ignored/uncommitted
254 test_expect_success 'status ignored tracked directory with uncommitted file in tracked subdir with --ignore' '
255 : >tracked/ignored/committed &&
256 git add -f tracked/ignored/committed &&
257 git commit -m. &&
258 git status --porcelain --ignored >actual &&
259 test_cmp expected actual
262 cat >expected <<\EOF
263 ?? .gitignore
264 ?? actual
265 ?? expected
266 !! tracked/ignored/uncommitted
269 test_expect_success 'status ignored tracked directory with uncommitted file in tracked subdir with --ignore -u' '
270 git status --porcelain --ignored -u >actual &&
271 test_cmp expected actual
274 test_done