]>
Commit | Line | Data |
---|---|---|
19a0acc8 DS |
1 | #!/bin/sh |
2 | ||
3 | test_description='compare full workdir to sparse workdir' | |
4 | ||
6e773527 | 5 | GIT_TEST_SPLIT_INDEX=0 |
122ba1f7 | 6 | GIT_TEST_SPARSE_INDEX= |
6e773527 | 7 | |
19a0acc8 DS |
8 | . ./test-lib.sh |
9 | ||
10 | test_expect_success 'setup' ' | |
11 | git init initial-repo && | |
12 | ( | |
ecfc47c0 | 13 | GIT_TEST_SPARSE_INDEX=0 && |
19a0acc8 DS |
14 | cd initial-repo && |
15 | echo a >a && | |
16 | echo "after deep" >e && | |
17 | echo "after folder1" >g && | |
18 | echo "after x" >z && | |
19 | mkdir folder1 folder2 deep x && | |
e669ffb2 | 20 | mkdir deep/deeper1 deep/deeper2 deep/before deep/later && |
19a0acc8 DS |
21 | mkdir deep/deeper1/deepest && |
22 | echo "after deeper1" >deep/e && | |
23 | echo "after deepest" >deep/deeper1/e && | |
24 | cp a folder1 && | |
25 | cp a folder2 && | |
26 | cp a x && | |
27 | cp a deep && | |
e669ffb2 | 28 | cp a deep/before && |
19a0acc8 DS |
29 | cp a deep/deeper1 && |
30 | cp a deep/deeper2 && | |
e669ffb2 | 31 | cp a deep/later && |
19a0acc8 DS |
32 | cp a deep/deeper1/deepest && |
33 | cp -r deep/deeper1/deepest deep/deeper2 && | |
e669ffb2 DS |
34 | mkdir deep/deeper1/0 && |
35 | mkdir deep/deeper1/0/0 && | |
36 | touch deep/deeper1/0/1 && | |
37 | touch deep/deeper1/0/0/0 && | |
38 | >folder1- && | |
39 | >folder1.x && | |
40 | >folder10 && | |
41 | cp -r deep/deeper1/0 folder1 && | |
42 | cp -r deep/deeper1/0 folder2 && | |
43 | echo >>folder1/0/0/0 && | |
44 | echo >>folder2/0/1 && | |
19a0acc8 DS |
45 | git add . && |
46 | git commit -m "initial commit" && | |
47 | git checkout -b base && | |
48 | for dir in folder1 folder2 deep | |
49 | do | |
50 | git checkout -b update-$dir && | |
51 | echo "updated $dir" >$dir/a && | |
52 | git commit -a -m "update $dir" || return 1 | |
53 | done && | |
54 | ||
55 | git checkout -b rename-base base && | |
3d814b5d | 56 | cat >folder1/larger-content <<-\EOF && |
19a0acc8 DS |
57 | matching |
58 | lines | |
59 | help | |
60 | inexact | |
61 | renames | |
62 | EOF | |
63 | cp folder1/larger-content folder2/ && | |
64 | cp folder1/larger-content deep/deeper1/ && | |
65 | git add . && | |
66 | git commit -m "add interesting rename content" && | |
67 | ||
68 | git checkout -b rename-out-to-out rename-base && | |
69 | mv folder1/a folder2/b && | |
70 | mv folder1/larger-content folder2/edited-content && | |
71 | echo >>folder2/edited-content && | |
e669ffb2 DS |
72 | echo >>folder2/0/1 && |
73 | echo stuff >>deep/deeper1/a && | |
19a0acc8 DS |
74 | git add . && |
75 | git commit -m "rename folder1/... to folder2/..." && | |
76 | ||
77 | git checkout -b rename-out-to-in rename-base && | |
78 | mv folder1/a deep/deeper1/b && | |
e669ffb2 DS |
79 | echo more stuff >>deep/deeper1/a && |
80 | rm folder2/0/1 && | |
81 | mkdir folder2/0/1 && | |
82 | echo >>folder2/0/1/1 && | |
19a0acc8 DS |
83 | mv folder1/larger-content deep/deeper1/edited-content && |
84 | echo >>deep/deeper1/edited-content && | |
85 | git add . && | |
86 | git commit -m "rename folder1/... to deep/deeper1/..." && | |
87 | ||
88 | git checkout -b rename-in-to-out rename-base && | |
89 | mv deep/deeper1/a folder1/b && | |
e669ffb2 DS |
90 | echo >>folder2/0/1 && |
91 | rm -rf folder1/0/0 && | |
92 | echo >>folder1/0/0 && | |
19a0acc8 DS |
93 | mv deep/deeper1/larger-content folder1/edited-content && |
94 | echo >>folder1/edited-content && | |
95 | git add . && | |
96 | git commit -m "rename deep/deeper1/... to folder1/..." && | |
97 | ||
98 | git checkout -b deepest base && | |
99 | echo "updated deepest" >deep/deeper1/deepest/a && | |
100 | git commit -a -m "update deepest" && | |
101 | ||
102 | git checkout -f base && | |
103 | git reset --hard | |
104 | ) | |
105 | ' | |
106 | ||
107 | init_repos () { | |
108 | rm -rf full-checkout sparse-checkout sparse-index && | |
109 | ||
110 | # create repos in initial state | |
111 | cp -r initial-repo full-checkout && | |
112 | git -C full-checkout reset --hard && | |
113 | ||
114 | cp -r initial-repo sparse-checkout && | |
115 | git -C sparse-checkout reset --hard && | |
ecfc47c0 DS |
116 | |
117 | cp -r initial-repo sparse-index && | |
118 | git -C sparse-index reset --hard && | |
19a0acc8 DS |
119 | |
120 | # initialize sparse-checkout definitions | |
ecfc47c0 DS |
121 | git -C sparse-checkout sparse-checkout init --cone && |
122 | git -C sparse-checkout sparse-checkout set deep && | |
122ba1f7 DS |
123 | git -C sparse-index sparse-checkout init --cone --sparse-index && |
124 | test_cmp_config -C sparse-index true index.sparse && | |
125 | git -C sparse-index sparse-checkout set deep | |
19a0acc8 DS |
126 | } |
127 | ||
128 | run_on_sparse () { | |
129 | ( | |
130 | cd sparse-checkout && | |
a96355d8 | 131 | GIT_PROGRESS_DELAY=100000 "$@" >../sparse-checkout-out 2>../sparse-checkout-err |
ecfc47c0 DS |
132 | ) && |
133 | ( | |
134 | cd sparse-index && | |
a96355d8 | 135 | GIT_PROGRESS_DELAY=100000 "$@" >../sparse-index-out 2>../sparse-index-err |
19a0acc8 DS |
136 | ) |
137 | } | |
138 | ||
139 | run_on_all () { | |
140 | ( | |
141 | cd full-checkout && | |
a96355d8 | 142 | GIT_PROGRESS_DELAY=100000 "$@" >../full-checkout-out 2>../full-checkout-err |
19a0acc8 | 143 | ) && |
4b3f765a | 144 | run_on_sparse "$@" |
19a0acc8 DS |
145 | } |
146 | ||
147 | test_all_match () { | |
4b3f765a | 148 | run_on_all "$@" && |
19a0acc8 | 149 | test_cmp full-checkout-out sparse-checkout-out && |
6e773527 DS |
150 | test_cmp full-checkout-out sparse-index-out && |
151 | test_cmp full-checkout-err sparse-checkout-err && | |
152 | test_cmp full-checkout-err sparse-index-err | |
19a0acc8 DS |
153 | } |
154 | ||
ecfc47c0 DS |
155 | test_sparse_match () { |
156 | run_on_sparse "$@" && | |
157 | test_cmp sparse-checkout-out sparse-index-out && | |
158 | test_cmp sparse-checkout-err sparse-index-err | |
159 | } | |
160 | ||
6e773527 DS |
161 | test_expect_success 'sparse-index contents' ' |
162 | init_repos && | |
163 | ||
164 | test-tool -C sparse-index read-cache --table >cache && | |
165 | for dir in folder1 folder2 x | |
166 | do | |
167 | TREE=$(git -C sparse-index rev-parse HEAD:$dir) && | |
168 | grep "040000 tree $TREE $dir/" cache \ | |
169 | || return 1 | |
170 | done && | |
171 | ||
122ba1f7 | 172 | git -C sparse-index sparse-checkout set folder1 && |
6e773527 DS |
173 | |
174 | test-tool -C sparse-index read-cache --table >cache && | |
175 | for dir in deep folder2 x | |
176 | do | |
177 | TREE=$(git -C sparse-index rev-parse HEAD:$dir) && | |
178 | grep "040000 tree $TREE $dir/" cache \ | |
179 | || return 1 | |
180 | done && | |
181 | ||
122ba1f7 | 182 | git -C sparse-index sparse-checkout set deep/deeper1 && |
6e773527 DS |
183 | |
184 | test-tool -C sparse-index read-cache --table >cache && | |
185 | for dir in deep/deeper2 folder1 folder2 x | |
186 | do | |
187 | TREE=$(git -C sparse-index rev-parse HEAD:$dir) && | |
188 | grep "040000 tree $TREE $dir/" cache \ | |
189 | || return 1 | |
122ba1f7 DS |
190 | done && |
191 | ||
192 | # Disabling the sparse-index removes tree entries with full ones | |
193 | git -C sparse-index sparse-checkout init --no-sparse-index && | |
194 | ||
195 | test-tool -C sparse-index read-cache --table >cache && | |
196 | ! grep "040000 tree" cache && | |
197 | test_sparse_match test-tool read-cache --table | |
6e773527 DS |
198 | ' |
199 | ||
2782db3e DS |
200 | test_expect_success 'expanded in-memory index matches full index' ' |
201 | init_repos && | |
202 | test_sparse_match test-tool read-cache --expand --table | |
203 | ' | |
204 | ||
19a0acc8 DS |
205 | test_expect_success 'status with options' ' |
206 | init_repos && | |
6e773527 | 207 | test_sparse_match ls && |
19a0acc8 DS |
208 | test_all_match git status --porcelain=v2 && |
209 | test_all_match git status --porcelain=v2 -z -u && | |
210 | test_all_match git status --porcelain=v2 -uno && | |
4b3f765a | 211 | run_on_all touch README.md && |
19a0acc8 DS |
212 | test_all_match git status --porcelain=v2 && |
213 | test_all_match git status --porcelain=v2 -z -u && | |
214 | test_all_match git status --porcelain=v2 -uno && | |
215 | test_all_match git add README.md && | |
216 | test_all_match git status --porcelain=v2 && | |
217 | test_all_match git status --porcelain=v2 -z -u && | |
218 | test_all_match git status --porcelain=v2 -uno | |
219 | ' | |
220 | ||
bf48e5ac DS |
221 | test_expect_success 'status reports sparse-checkout' ' |
222 | init_repos && | |
223 | git -C sparse-checkout status >full && | |
224 | git -C sparse-index status >sparse && | |
225 | test_i18ngrep "You are in a sparse checkout with " full && | |
226 | test_i18ngrep "You are in a sparse checkout." sparse | |
227 | ' | |
228 | ||
19a0acc8 DS |
229 | test_expect_success 'add, commit, checkout' ' |
230 | init_repos && | |
231 | ||
232 | write_script edit-contents <<-\EOF && | |
233 | echo text >>$1 | |
234 | EOF | |
4b3f765a | 235 | run_on_all ../edit-contents README.md && |
19a0acc8 DS |
236 | |
237 | test_all_match git add README.md && | |
238 | test_all_match git status --porcelain=v2 && | |
239 | test_all_match git commit -m "Add README.md" && | |
240 | ||
241 | test_all_match git checkout HEAD~1 && | |
242 | test_all_match git checkout - && | |
243 | ||
4b3f765a | 244 | run_on_all ../edit-contents README.md && |
19a0acc8 DS |
245 | |
246 | test_all_match git add -A && | |
247 | test_all_match git status --porcelain=v2 && | |
248 | test_all_match git commit -m "Extend README.md" && | |
249 | ||
250 | test_all_match git checkout HEAD~1 && | |
251 | test_all_match git checkout - && | |
252 | ||
4b3f765a | 253 | run_on_all ../edit-contents deep/newfile && |
19a0acc8 DS |
254 | |
255 | test_all_match git status --porcelain=v2 -uno && | |
256 | test_all_match git status --porcelain=v2 && | |
257 | test_all_match git add . && | |
258 | test_all_match git status --porcelain=v2 && | |
259 | test_all_match git commit -m "add deep/newfile" && | |
260 | ||
261 | test_all_match git checkout HEAD~1 && | |
262 | test_all_match git checkout - | |
263 | ' | |
264 | ||
bf26c06f DS |
265 | test_expect_success 'status/add: outside sparse cone' ' |
266 | init_repos && | |
267 | ||
268 | # adding a "missing" file outside the cone should fail | |
269 | test_sparse_match test_must_fail git add folder1/a && | |
270 | ||
271 | # folder1 is at HEAD, but outside the sparse cone | |
272 | run_on_sparse mkdir folder1 && | |
273 | cp initial-repo/folder1/a sparse-checkout/folder1/a && | |
274 | cp initial-repo/folder1/a sparse-index/folder1/a && | |
275 | ||
276 | test_sparse_match git status && | |
277 | ||
278 | write_script edit-contents <<-\EOF && | |
279 | echo text >>$1 | |
280 | EOF | |
281 | run_on_sparse ../edit-contents folder1/a && | |
282 | run_on_all ../edit-contents folder1/new && | |
283 | ||
284 | test_sparse_match git status --porcelain=v2 && | |
285 | ||
286 | # This "git add folder1/a" fails with a warning | |
287 | # in the sparse repos, differing from the full | |
288 | # repo. This is intentional. | |
289 | test_sparse_match test_must_fail git add folder1/a && | |
290 | test_sparse_match test_must_fail git add --refresh folder1/a && | |
291 | test_all_match git status --porcelain=v2 && | |
292 | ||
293 | test_all_match git add . && | |
294 | test_all_match git status --porcelain=v2 && | |
295 | test_all_match git commit -m folder1/new && | |
296 | ||
297 | run_on_all ../edit-contents folder1/newer && | |
298 | test_all_match git add folder1/ && | |
299 | test_all_match git status --porcelain=v2 && | |
300 | test_all_match git commit -m folder1/newer | |
301 | ' | |
302 | ||
19a0acc8 DS |
303 | test_expect_success 'checkout and reset --hard' ' |
304 | init_repos && | |
305 | ||
306 | test_all_match git checkout update-folder1 && | |
307 | test_all_match git status --porcelain=v2 && | |
308 | ||
309 | test_all_match git checkout update-deep && | |
310 | test_all_match git status --porcelain=v2 && | |
311 | ||
312 | test_all_match git checkout -b reset-test && | |
313 | test_all_match git reset --hard deepest && | |
314 | test_all_match git reset --hard update-folder1 && | |
315 | test_all_match git reset --hard update-folder2 | |
316 | ' | |
317 | ||
318 | test_expect_success 'diff --staged' ' | |
319 | init_repos && | |
320 | ||
321 | write_script edit-contents <<-\EOF && | |
322 | echo text >>README.md | |
323 | EOF | |
4b3f765a | 324 | run_on_all ../edit-contents && |
19a0acc8 DS |
325 | |
326 | test_all_match git diff && | |
327 | test_all_match git diff --staged && | |
328 | test_all_match git add README.md && | |
329 | test_all_match git diff && | |
330 | test_all_match git diff --staged | |
331 | ' | |
332 | ||
e669ffb2 | 333 | test_expect_success 'diff with renames and conflicts' ' |
19a0acc8 DS |
334 | init_repos && |
335 | ||
336 | for branch in rename-out-to-out rename-out-to-in rename-in-to-out | |
337 | do | |
338 | test_all_match git checkout rename-base && | |
e669ffb2 DS |
339 | test_all_match git checkout $branch -- . && |
340 | test_all_match git status --porcelain=v2 && | |
341 | test_all_match git diff --staged --no-renames && | |
342 | test_all_match git diff --staged --find-renames || return 1 | |
343 | done | |
344 | ' | |
345 | ||
346 | test_expect_success 'diff with directory/file conflicts' ' | |
347 | init_repos && | |
348 | ||
349 | for branch in rename-out-to-out rename-out-to-in rename-in-to-out | |
350 | do | |
351 | git -C full-checkout reset --hard && | |
352 | test_sparse_match git reset --hard && | |
353 | test_all_match git checkout $branch && | |
354 | test_all_match git checkout rename-base -- . && | |
355 | test_all_match git status --porcelain=v2 && | |
19a0acc8 DS |
356 | test_all_match git diff --staged --no-renames && |
357 | test_all_match git diff --staged --find-renames || return 1 | |
358 | done | |
359 | ' | |
360 | ||
361 | test_expect_success 'log with pathspec outside sparse definition' ' | |
362 | init_repos && | |
363 | ||
364 | test_all_match git log -- a && | |
365 | test_all_match git log -- folder1/a && | |
366 | test_all_match git log -- folder2/a && | |
367 | test_all_match git log -- deep/a && | |
368 | test_all_match git log -- deep/deeper1/a && | |
369 | test_all_match git log -- deep/deeper1/deepest/a && | |
370 | ||
371 | test_all_match git checkout update-folder1 && | |
372 | test_all_match git log -- folder1/a | |
373 | ' | |
374 | ||
375 | test_expect_success 'blame with pathspec inside sparse definition' ' | |
376 | init_repos && | |
377 | ||
378 | test_all_match git blame a && | |
379 | test_all_match git blame deep/a && | |
380 | test_all_match git blame deep/deeper1/a && | |
381 | test_all_match git blame deep/deeper1/deepest/a | |
382 | ' | |
383 | ||
384 | # TODO: blame currently does not support blaming files outside of the | |
385 | # sparse definition. It complains that the file doesn't exist locally. | |
386 | test_expect_failure 'blame with pathspec outside sparse definition' ' | |
387 | init_repos && | |
388 | ||
389 | test_all_match git blame folder1/a && | |
390 | test_all_match git blame folder2/a && | |
391 | test_all_match git blame deep/deeper2/a && | |
392 | test_all_match git blame deep/deeper2/deepest/a | |
393 | ' | |
394 | ||
e5ca2910 DS |
395 | # NEEDSWORK: a sparse-checkout behaves differently from a full checkout |
396 | # in this scenario, but it shouldn't. | |
19a0acc8 DS |
397 | test_expect_failure 'checkout and reset (mixed)' ' |
398 | init_repos && | |
399 | ||
400 | test_all_match git checkout -b reset-test update-deep && | |
401 | test_all_match git reset deepest && | |
402 | test_all_match git reset update-folder1 && | |
403 | test_all_match git reset update-folder2 | |
404 | ' | |
405 | ||
e5ca2910 DS |
406 | # NEEDSWORK: a sparse-checkout behaves differently from a full checkout |
407 | # in this scenario, but it shouldn't. | |
6e773527 DS |
408 | test_expect_success 'checkout and reset (mixed) [sparse]' ' |
409 | init_repos && | |
410 | ||
411 | test_sparse_match git checkout -b reset-test update-deep && | |
412 | test_sparse_match git reset deepest && | |
413 | test_sparse_match git reset update-folder1 && | |
414 | test_sparse_match git reset update-folder2 | |
415 | ' | |
416 | ||
19a0acc8 DS |
417 | test_expect_success 'merge' ' |
418 | init_repos && | |
419 | ||
420 | test_all_match git checkout -b merge update-deep && | |
421 | test_all_match git merge -m "folder1" update-folder1 && | |
422 | test_all_match git rev-parse HEAD^{tree} && | |
423 | test_all_match git merge -m "folder2" update-folder2 && | |
424 | test_all_match git rev-parse HEAD^{tree} | |
425 | ' | |
426 | ||
427 | test_expect_success 'merge with outside renames' ' | |
428 | init_repos && | |
429 | ||
430 | for type in out-to-out out-to-in in-to-out | |
431 | do | |
432 | test_all_match git reset --hard && | |
433 | test_all_match git checkout -f -b merge-$type update-deep && | |
434 | test_all_match git merge -m "$type" rename-$type && | |
435 | test_all_match git rev-parse HEAD^{tree} || return 1 | |
436 | done | |
437 | ' | |
438 | ||
fc6609d1 DS |
439 | # Sparse-index fails to convert the index in the |
440 | # final 'git cherry-pick' command. | |
441 | test_expect_success 'cherry-pick with conflicts' ' | |
442 | init_repos && | |
443 | ||
444 | write_script edit-conflict <<-\EOF && | |
445 | echo $1 >conflict | |
446 | EOF | |
447 | ||
448 | test_all_match git checkout -b to-cherry-pick && | |
449 | run_on_all ../edit-conflict ABC && | |
450 | test_all_match git add conflict && | |
451 | test_all_match git commit -m "conflict to pick" && | |
452 | ||
453 | test_all_match git checkout -B base HEAD~1 && | |
454 | run_on_all ../edit-conflict DEF && | |
455 | test_all_match git add conflict && | |
456 | test_all_match git commit -m "conflict in base" && | |
457 | ||
458 | test_all_match test_must_fail git cherry-pick to-cherry-pick | |
459 | ' | |
460 | ||
19a0acc8 DS |
461 | test_expect_success 'clean' ' |
462 | init_repos && | |
463 | ||
464 | echo bogus >>.gitignore && | |
465 | run_on_all cp ../.gitignore . && | |
466 | test_all_match git add .gitignore && | |
4b3f765a | 467 | test_all_match git commit -m "ignore bogus files" && |
19a0acc8 DS |
468 | |
469 | run_on_sparse mkdir folder1 && | |
470 | run_on_all touch folder1/bogus && | |
471 | ||
472 | test_all_match git status --porcelain=v2 && | |
473 | test_all_match git clean -f && | |
474 | test_all_match git status --porcelain=v2 && | |
6e773527 DS |
475 | test_sparse_match ls && |
476 | test_sparse_match ls folder1 && | |
19a0acc8 DS |
477 | |
478 | test_all_match git clean -xf && | |
479 | test_all_match git status --porcelain=v2 && | |
6e773527 DS |
480 | test_sparse_match ls && |
481 | test_sparse_match ls folder1 && | |
19a0acc8 DS |
482 | |
483 | test_all_match git clean -xdf && | |
484 | test_all_match git status --porcelain=v2 && | |
6e773527 DS |
485 | test_sparse_match ls && |
486 | test_sparse_match ls folder1 && | |
19a0acc8 | 487 | |
6e773527 | 488 | test_sparse_match test_path_is_dir folder1 |
19a0acc8 DS |
489 | ' |
490 | ||
f442313e DS |
491 | test_expect_success 'submodule handling' ' |
492 | init_repos && | |
493 | ||
494 | test_all_match mkdir modules && | |
495 | test_all_match touch modules/a && | |
496 | test_all_match git add modules && | |
497 | test_all_match git commit -m "add modules directory" && | |
498 | ||
499 | run_on_all git submodule add "$(pwd)/initial-repo" modules/sub && | |
500 | test_all_match git commit -m "add submodule" && | |
501 | ||
502 | # having a submodule prevents "modules" from collapse | |
503 | test-tool -C sparse-index read-cache --table >cache && | |
504 | grep "100644 blob .* modules/a" cache && | |
505 | grep "160000 commit $(git -C initial-repo rev-parse HEAD) modules/sub" cache | |
506 | ' | |
507 | ||
0938e6ff DS |
508 | test_expect_success 'sparse-index is expanded and converted back' ' |
509 | init_repos && | |
510 | ||
122ba1f7 DS |
511 | GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ |
512 | git -C sparse-index -c core.fsmonitor="" reset --hard && | |
513 | test_region index convert_to_sparse trace2.txt && | |
d76723ee DS |
514 | test_region index ensure_full_index trace2.txt |
515 | ' | |
122ba1f7 | 516 | |
d76723ee DS |
517 | test_expect_success 'sparse-index is not expanded' ' |
518 | init_repos && | |
519 | ||
520 | rm -f trace2.txt && | |
521 | echo >>sparse-index/untracked.txt && | |
122ba1f7 | 522 | GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ |
d76723ee DS |
523 | git -C sparse-index status && |
524 | test_region ! index ensure_full_index trace2.txt | |
0938e6ff DS |
525 | ' |
526 | ||
e5ca2910 DS |
527 | # NEEDSWORK: a sparse-checkout behaves differently from a full checkout |
528 | # in this scenario, but it shouldn't. | |
fe0d5761 DS |
529 | test_expect_success 'reset mixed and checkout orphan' ' |
530 | init_repos && | |
531 | ||
532 | test_all_match git checkout rename-out-to-in && | |
533 | ||
534 | # Sparse checkouts do not agree with full checkouts about | |
535 | # how to report a directory/file conflict during a reset. | |
536 | # This command would fail with test_all_match because the | |
537 | # full checkout reports "T folder1/0/1" while a sparse | |
538 | # checkout reports "D folder1/0/1". This matches because | |
539 | # the sparse checkouts skip "adding" the other side of | |
540 | # the conflict. | |
541 | test_sparse_match git reset --mixed HEAD~1 && | |
542 | test_sparse_match test-tool read-cache --table --expand && | |
543 | test_sparse_match git status --porcelain=v2 && | |
544 | ||
545 | # At this point, sparse-checkouts behave differently | |
546 | # from the full-checkout. | |
547 | test_sparse_match git checkout --orphan new-branch && | |
548 | test_sparse_match test-tool read-cache --table --expand && | |
549 | test_sparse_match git status --porcelain=v2 | |
550 | ' | |
551 | ||
552 | test_expect_success 'add everything with deep new file' ' | |
553 | init_repos && | |
554 | ||
555 | run_on_sparse git sparse-checkout set deep/deeper1/deepest && | |
556 | ||
557 | run_on_all touch deep/deeper1/x && | |
558 | test_all_match git add . && | |
559 | test_all_match git status --porcelain=v2 | |
560 | ' | |
561 | ||
19a0acc8 | 562 | test_done |