]>
Commit | Line | Data |
---|---|---|
eb8c5b87 AP |
1 | #!/bin/sh |
2 | ||
3 | test_description='git-status ignored files' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | cat >expected <<\EOF | |
8 | ?? .gitignore | |
9 | ?? actual | |
10 | ?? expected | |
11 | ?? untracked/ | |
12 | EOF | |
13 | ||
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 | |
21 | ' | |
22 | ||
23 | cat >expected <<\EOF | |
24 | ?? .gitignore | |
25 | ?? actual | |
26 | ?? expected | |
27 | ?? untracked/uncommitted | |
28 | !! untracked/ignored | |
29 | EOF | |
30 | ||
31 | test_expect_success 'status untracked directory with --ignored -u' ' | |
32 | git status --porcelain --ignored -u >actual && | |
33 | test_cmp expected actual | |
34 | ' | |
be8a84c5 KB |
35 | cat >expected <<\EOF |
36 | ?? untracked/uncommitted | |
37 | !! untracked/ignored | |
38 | EOF | |
39 | ||
40 | test_expect_success 'status prefixed untracked directory with --ignored' ' | |
41 | git status --porcelain --ignored untracked/ >actual && | |
42 | test_cmp expected actual | |
43 | ' | |
44 | ||
45 | cat >expected <<\EOF | |
46 | ?? untracked/uncommitted | |
47 | !! untracked/ignored | |
48 | EOF | |
49 | ||
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 | |
53 | ' | |
eb8c5b87 AP |
54 | |
55 | cat >expected <<\EOF | |
56 | ?? .gitignore | |
57 | ?? actual | |
58 | ?? expected | |
59 | !! ignored/ | |
60 | EOF | |
61 | ||
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 | |
68 | ' | |
69 | ||
70 | cat >expected <<\EOF | |
71 | ?? .gitignore | |
72 | ?? actual | |
73 | ?? expected | |
74 | !! ignored/uncommitted | |
75 | EOF | |
76 | ||
77 | test_expect_success 'status ignored directory with --ignore -u' ' | |
78 | git status --porcelain --ignored -u >actual && | |
79 | test_cmp expected actual | |
80 | ' | |
81 | ||
82 | cat >expected <<\EOF | |
83 | ?? .gitignore | |
84 | ?? actual | |
85 | ?? expected | |
eb8c5b87 AP |
86 | EOF |
87 | ||
c94ab010 | 88 | test_expect_success 'status empty untracked directory with --ignore' ' |
eb8c5b87 AP |
89 | rm -rf ignored && |
90 | mkdir untracked-ignored && | |
91 | mkdir untracked-ignored/test && | |
c94ab010 KB |
92 | git status --porcelain --ignored >actual && |
93 | test_cmp expected actual | |
94 | ' | |
95 | ||
96 | cat >expected <<\EOF | |
97 | ?? .gitignore | |
98 | ?? actual | |
99 | ?? expected | |
100 | EOF | |
101 | ||
102 | test_expect_success 'status empty untracked directory with --ignore -u' ' | |
103 | git status --porcelain --ignored -u >actual && | |
104 | test_cmp expected actual | |
105 | ' | |
106 | ||
107 | cat >expected <<\EOF | |
108 | ?? .gitignore | |
109 | ?? actual | |
110 | ?? expected | |
111 | !! untracked-ignored/ | |
112 | EOF | |
113 | ||
114 | test_expect_success 'status untracked directory with ignored files with --ignore' ' | |
eb8c5b87 AP |
115 | : >untracked-ignored/ignored && |
116 | : >untracked-ignored/test/ignored && | |
117 | git status --porcelain --ignored >actual && | |
118 | test_cmp expected actual | |
119 | ' | |
120 | ||
121 | cat >expected <<\EOF | |
122 | ?? .gitignore | |
123 | ?? actual | |
124 | ?? expected | |
125 | !! untracked-ignored/ignored | |
126 | !! untracked-ignored/test/ignored | |
127 | EOF | |
128 | ||
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 | |
132 | ' | |
133 | ||
134 | cat >expected <<\EOF | |
135 | ?? .gitignore | |
136 | ?? actual | |
137 | ?? expected | |
138 | EOF | |
139 | ||
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 | |
149 | ' | |
150 | ||
151 | cat >expected <<\EOF | |
152 | ?? .gitignore | |
153 | ?? actual | |
154 | ?? expected | |
155 | EOF | |
156 | ||
157 | test_expect_success 'status ignored tracked directory with --ignore -u' ' | |
158 | git status --porcelain --ignored -u >actual && | |
159 | test_cmp expected actual | |
160 | ' | |
161 | ||
0104c9e7 KB |
162 | cat >expected <<\EOF |
163 | ?? .gitignore | |
164 | ?? actual | |
165 | ?? expected | |
166 | EOF | |
167 | ||
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 | |
172 | ' | |
173 | ||
174 | cat >expected <<\EOF | |
175 | ?? .gitignore | |
176 | ?? actual | |
177 | ?? expected | |
178 | EOF | |
179 | ||
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 | |
183 | ' | |
184 | ||
eb8c5b87 AP |
185 | cat >expected <<\EOF |
186 | ?? .gitignore | |
187 | ?? actual | |
188 | ?? expected | |
5bd8e2d8 | 189 | !! tracked/uncommitted |
eb8c5b87 AP |
190 | EOF |
191 | ||
192 | test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' ' | |
0104c9e7 | 193 | echo "tracked" >.gitignore && |
eb8c5b87 AP |
194 | : >tracked/uncommitted && |
195 | git status --porcelain --ignored >actual && | |
196 | test_cmp expected actual | |
197 | ' | |
198 | ||
199 | cat >expected <<\EOF | |
200 | ?? .gitignore | |
201 | ?? actual | |
202 | ?? expected | |
203 | !! tracked/uncommitted | |
204 | EOF | |
205 | ||
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 | |
209 | ' | |
210 | ||
560bb7a7 KB |
211 | cat >expected <<\EOF |
212 | ?? .gitignore | |
213 | ?? actual | |
214 | ?? expected | |
5bd8e2d8 | 215 | !! tracked/ignored/ |
560bb7a7 KB |
216 | EOF |
217 | ||
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 | |
224 | ' | |
225 | ||
226 | cat >expected <<\EOF | |
227 | ?? .gitignore | |
228 | ?? actual | |
229 | ?? expected | |
230 | !! tracked/ignored/uncommitted | |
231 | EOF | |
232 | ||
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 | |
236 | ' | |
237 | ||
289ff559 KB |
238 | cat >expected <<\EOF |
239 | ?? .gitignore | |
240 | ?? actual | |
241 | ?? expected | |
5bd8e2d8 | 242 | !! tracked/ignored/uncommitted |
289ff559 KB |
243 | EOF |
244 | ||
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 | |
251 | ' | |
252 | ||
253 | cat >expected <<\EOF | |
254 | ?? .gitignore | |
255 | ?? actual | |
256 | ?? expected | |
257 | !! tracked/ignored/uncommitted | |
258 | EOF | |
259 | ||
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 | |
263 | ' | |
264 | ||
eb8c5b87 | 265 | test_done |