apply: reject input that touches outside the working area
[git/mingw/j6t.git] / t / t7061-wtstatus-ignore.sh
blob460789b4d85241eb51c0c1a5a1f4be7d4a0d7154
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 cat >expected <<\EOF
24 ?? .gitignore
25 ?? actual
26 ?? expected
27 ?? untracked/uncommitted
28 !! untracked/ignored
29 EOF
31 test_expect_success 'status untracked directory with --ignored -u' '
32 git status --porcelain --ignored -u >actual &&
33 test_cmp expected actual
35 cat >expected <<\EOF
36 ?? untracked/uncommitted
37 !! untracked/ignored
38 EOF
40 test_expect_success 'status prefixed untracked directory with --ignored' '
41 git status --porcelain --ignored untracked/ >actual &&
42 test_cmp expected actual
45 cat >expected <<\EOF
46 ?? untracked/uncommitted
47 !! untracked/ignored
48 EOF
50 test_expect_success 'status prefixed untracked sub-directory with --ignored -u' '
51 git status --porcelain --ignored -u untracked/ >actual &&
52 test_cmp expected actual
55 cat >expected <<\EOF
56 ?? .gitignore
57 ?? actual
58 ?? expected
59 !! ignored/
60 EOF
62 test_expect_success 'status ignored directory with --ignore' '
63 rm -rf untracked &&
64 mkdir ignored &&
65 : >ignored/uncommitted &&
66 git status --porcelain --ignored >actual &&
67 test_cmp expected actual
70 cat >expected <<\EOF
71 ?? .gitignore
72 ?? actual
73 ?? expected
74 !! ignored/uncommitted
75 EOF
77 test_expect_success 'status ignored directory with --ignore -u' '
78 git status --porcelain --ignored -u >actual &&
79 test_cmp expected actual
82 cat >expected <<\EOF
83 ?? .gitignore
84 ?? actual
85 ?? expected
86 EOF
88 test_expect_success 'status empty untracked directory with --ignore' '
89 rm -rf ignored &&
90 mkdir untracked-ignored &&
91 mkdir untracked-ignored/test &&
92 git status --porcelain --ignored >actual &&
93 test_cmp expected actual
96 cat >expected <<\EOF
97 ?? .gitignore
98 ?? actual
99 ?? expected
102 test_expect_success 'status empty untracked directory with --ignore -u' '
103 git status --porcelain --ignored -u >actual &&
104 test_cmp expected actual
107 cat >expected <<\EOF
108 ?? .gitignore
109 ?? actual
110 ?? expected
111 !! untracked-ignored/
114 test_expect_success 'status untracked directory with ignored files with --ignore' '
115 : >untracked-ignored/ignored &&
116 : >untracked-ignored/test/ignored &&
117 git status --porcelain --ignored >actual &&
118 test_cmp expected actual
121 cat >expected <<\EOF
122 ?? .gitignore
123 ?? actual
124 ?? expected
125 !! untracked-ignored/ignored
126 !! untracked-ignored/test/ignored
129 test_expect_success 'status untracked directory with ignored files with --ignore -u' '
130 git status --porcelain --ignored -u >actual &&
131 test_cmp expected actual
134 cat >expected <<\EOF
135 ?? .gitignore
136 ?? actual
137 ?? expected
140 test_expect_success 'status ignored tracked directory with --ignore' '
141 rm -rf untracked-ignored &&
142 mkdir tracked &&
143 : >tracked/committed &&
144 git add tracked/committed &&
145 git commit -m. &&
146 echo "tracked" >.gitignore &&
147 git status --porcelain --ignored >actual &&
148 test_cmp expected actual
151 cat >expected <<\EOF
152 ?? .gitignore
153 ?? actual
154 ?? expected
157 test_expect_success 'status ignored tracked directory with --ignore -u' '
158 git status --porcelain --ignored -u >actual &&
159 test_cmp expected actual
162 cat >expected <<\EOF
163 ?? .gitignore
164 ?? actual
165 ?? expected
168 test_expect_success 'status ignored tracked directory and ignored file with --ignore' '
169 echo "committed" >>.gitignore &&
170 git status --porcelain --ignored >actual &&
171 test_cmp expected actual
174 cat >expected <<\EOF
175 ?? .gitignore
176 ?? actual
177 ?? expected
180 test_expect_success 'status ignored tracked directory and ignored file with --ignore -u' '
181 git status --porcelain --ignored -u >actual &&
182 test_cmp expected actual
185 cat >expected <<\EOF
186 ?? .gitignore
187 ?? actual
188 ?? expected
189 !! tracked/uncommitted
192 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' '
193 echo "tracked" >.gitignore &&
194 : >tracked/uncommitted &&
195 git status --porcelain --ignored >actual &&
196 test_cmp expected actual
199 cat >expected <<\EOF
200 ?? .gitignore
201 ?? actual
202 ?? expected
203 !! tracked/uncommitted
206 test_expect_success 'status ignored tracked directory and uncommitted file with --ignore -u' '
207 git status --porcelain --ignored -u >actual &&
208 test_cmp expected actual
211 cat >expected <<\EOF
212 ?? .gitignore
213 ?? actual
214 ?? expected
215 !! tracked/ignored/
218 test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore' '
219 rm -rf tracked/uncommitted &&
220 mkdir tracked/ignored &&
221 : >tracked/ignored/uncommitted &&
222 git status --porcelain --ignored >actual &&
223 test_cmp expected actual
226 cat >expected <<\EOF
227 ?? .gitignore
228 ?? actual
229 ?? expected
230 !! tracked/ignored/uncommitted
233 test_expect_success 'status ignored tracked directory with uncommitted file in untracked subdir with --ignore -u' '
234 git status --porcelain --ignored -u >actual &&
235 test_cmp expected actual
238 cat >expected <<\EOF
239 ?? .gitignore
240 ?? actual
241 ?? expected
242 !! tracked/ignored/uncommitted
245 test_expect_success 'status ignored tracked directory with uncommitted file in tracked subdir with --ignore' '
246 : >tracked/ignored/committed &&
247 git add -f tracked/ignored/committed &&
248 git commit -m. &&
249 git status --porcelain --ignored >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 -u' '
261 git status --porcelain --ignored -u >actual &&
262 test_cmp expected actual
265 test_done