pull: don't warn if pull.ff has been set
[git/debian.git] / t / t7061-wtstatus-ignore.sh
blobe4cf5484f97a570da8225ca501d3b395e13604e3
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 !! untracked/ignored
13 EOF
15 test_expect_success 'status untracked directory with --ignored' '
16 echo "ignored" >.gitignore &&
17 mkdir untracked &&
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 &&
26 mkdir -p untracked &&
27 : >untracked/ignored &&
28 : >untracked/uncommitted &&
29 git status --porcelain --ignored >actual &&
30 test_cmp expected actual
33 cat >expected <<\EOF
34 ?? .gitignore
35 ?? actual
36 ?? expected
37 ?? untracked/uncommitted
38 !! untracked/ignored
39 EOF
41 test_expect_success 'status untracked directory with --ignored -u' '
42 git status --porcelain --ignored -u >actual &&
43 test_cmp expected actual
45 cat >expected <<\EOF
46 ?? untracked/
47 !! untracked/ignored
48 EOF
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 &&
53 rm tmp &&
54 test_cmp expected actual &&
56 git status --porcelain --ignored untracked/ >actual &&
57 test_cmp expected actual
60 cat >expected <<\EOF
61 ?? untracked/uncommitted
62 !! untracked/ignored
63 EOF
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
70 cat >expected <<\EOF
71 ?? .gitignore
72 ?? actual
73 ?? expected
74 !! ignored/
75 EOF
77 test_expect_success 'status ignored directory with --ignore' '
78 rm -rf untracked &&
79 mkdir ignored &&
80 : >ignored/uncommitted &&
81 git status --porcelain --ignored >actual &&
82 test_cmp expected actual
85 cat >expected <<\EOF
86 ?? .gitignore
87 ?? actual
88 ?? expected
89 !! ignored/uncommitted
90 EOF
92 test_expect_success 'status ignored directory with --ignore -u' '
93 git status --porcelain --ignored -u >actual &&
94 test_cmp expected actual
97 cat >expected <<\EOF
98 ?? .gitignore
99 ?? actual
100 ?? expected
103 test_expect_success 'status empty untracked directory with --ignore' '
104 rm -rf ignored &&
105 mkdir untracked-ignored &&
106 mkdir untracked-ignored/test &&
107 git status --porcelain --ignored >actual &&
108 test_cmp expected actual
111 cat >expected <<\EOF
112 ?? .gitignore
113 ?? actual
114 ?? expected
117 test_expect_success 'status empty untracked directory with --ignore -u' '
118 git status --porcelain --ignored -u >actual &&
119 test_cmp expected actual
122 cat >expected <<\EOF
123 ?? .gitignore
124 ?? actual
125 ?? expected
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
136 cat >expected <<\EOF
137 ?? .gitignore
138 ?? actual
139 ?? expected
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
149 cat >expected <<\EOF
150 ?? .gitignore
151 ?? actual
152 ?? expected
155 test_expect_success 'status ignored tracked directory with --ignore' '
156 rm -rf untracked-ignored &&
157 mkdir tracked &&
158 : >tracked/committed &&
159 git add tracked/committed &&
160 git commit -m. &&
161 echo "tracked" >.gitignore &&
162 git status --porcelain --ignored >actual &&
163 test_cmp expected actual
166 cat >expected <<\EOF
167 ?? .gitignore
168 ?? actual
169 ?? expected
172 test_expect_success 'status ignored tracked directory with --ignore -u' '
173 git status --porcelain --ignored -u >actual &&
174 test_cmp expected actual
177 cat >expected <<\EOF
178 ?? .gitignore
179 ?? actual
180 ?? expected
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
189 cat >expected <<\EOF
190 ?? .gitignore
191 ?? actual
192 ?? expected
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
200 cat >expected <<\EOF
201 ?? .gitignore
202 ?? actual
203 ?? expected
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
214 cat >expected <<\EOF
215 ?? .gitignore
216 ?? actual
217 ?? expected
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
226 cat >expected <<\EOF
227 ?? .gitignore
228 ?? actual
229 ?? expected
230 !! tracked/ignored/
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
241 cat >expected <<\EOF
242 ?? .gitignore
243 ?? actual
244 ?? expected
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
253 cat >expected <<\EOF
254 ?? .gitignore
255 ?? actual
256 ?? expected
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 &&
263 git commit -m. &&
264 git status --porcelain --ignored >actual &&
265 test_cmp expected actual
268 cat >expected <<\EOF
269 ?? .gitignore
270 ?? actual
271 ?? expected
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
280 cat >expected <<\EOF
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
291 test_done