@matheusbsbs / matheus-bagliano / commits / da1e295e00
Fork 0

t604[236]: do not run setup in separate tests

Transform the setup "tests" to setup functions, and have the actual tests call the setup functions. Advantages: * Should make life easier for people working with webby CI/PR builds who have to abuse mice (and their own index finger as well) in order to switch from viewing one testcase to another. Sounds awful; hopefully this will improve things for them. * Improves re-runnability: any failed test in any of these three files can now be re-run in isolation, e.g. ./t6042* --ver --imm -x --run=21 whereas before it would require two tests to be specified to the --run argument, the other needing to be picked out as the relevant setup test from one or two tests before. * Importantly, this still keeps the "setup" and "test" sections somewhat separate to make it easier for readers to discern what is just ancillary setup and what the intent of the test is. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Oct 22, 2019 at 21:22 UTC da1e295e008ba016eef008385afb2c20c7fc3ff8
3 files changed +393 -319
t/t6042-merge-rename-corner-cases.sh
+67 -44
@@ -5,7 +5,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses"
5
6 . ./test-lib.sh
7
8 -test_expect_success 'setup rename/delete + untracked file' '
8 +test_setup_rename_delete_untracked () {
9 test_create_repo rename-delete-untracked &&
10 (
11 cd rename-delete-untracked &&
@@ -29,9 +29,10 @@ test_expect_success 'setup rename/delete + untracked file' '
29 git commit -m track-people-instead-of-objects &&
30 echo "Myyy PRECIOUSSS" >ring
31 )
32 -'
32 +}
33
34 test_expect_success "Does git preserve Gollum's precious artifact?" '
35 + test_setup_rename_delete_untracked &&
36 (
37 cd rename-delete-untracked &&
38
@@ -49,7 +50,7 @@ test_expect_success "Does git preserve Gollum's precious artifact?" '
50 #
51 # We should be able to merge B & C cleanly
52
52 -test_expect_success 'setup rename/modify/add-source conflict' '
53 +test_setup_rename_modify_add_source () {
54 test_create_repo rename-modify-add-source &&
55 (
56 cd rename-modify-add-source &&
@@ -70,9 +71,10 @@ test_expect_success 'setup rename/modify/add-source conflict' '
71 git add a &&
72 git commit -m C
73 )
73 -'
74 +}
75
76 test_expect_failure 'rename/modify/add-source conflict resolvable' '
77 + test_setup_rename_modify_add_source &&
78 (
79 cd rename-modify-add-source &&
80
@@ -88,7 +90,7 @@ test_expect_failure 'rename/modify/add-source conflict resolvable' '
90 )
91 '
92
91 -test_expect_success 'setup resolvable conflict missed if rename missed' '
93 +test_setup_break_detection_1 () {
94 test_create_repo break-detection-1 &&
95 (
96 cd break-detection-1 &&
@@ -110,9 +112,10 @@ test_expect_success 'setup resolvable conflict missed if rename missed' '
112 git add a &&
113 git commit -m C
114 )
113 -'
115 +}
116
117 test_expect_failure 'conflict caused if rename not detected' '
118 + test_setup_break_detection_1 &&
119 (
120 cd break-detection-1 &&
121
@@ -135,7 +138,7 @@ test_expect_failure 'conflict caused if rename not detected' '
138 )
139 '
140
138 -test_expect_success 'setup conflict resolved wrong if rename missed' '
141 +test_setup_break_detection_2 () {
142 test_create_repo break-detection-2 &&
143 (
144 cd break-detection-2 &&
@@ -160,9 +163,10 @@ test_expect_success 'setup conflict resolved wrong if rename missed' '
163 git add a &&
164 git commit -m E
165 )
163 -'
166 +}
167
168 test_expect_failure 'missed conflict if rename not detected' '
169 + test_setup_break_detection_2 &&
170 (
171 cd break-detection-2 &&
172
@@ -182,7 +186,7 @@ test_expect_failure 'missed conflict if rename not detected' '
186 # Commit B: rename a->b
187 # Commit C: rename a->b, add unrelated a
188
185 -test_expect_success 'setup undetected rename/add-source causes data loss' '
189 +test_setup_break_detection_3 () {
190 test_create_repo break-detection-3 &&
191 (
192 cd break-detection-3 &&
@@ -202,9 +206,10 @@ test_expect_success 'setup undetected rename/add-source causes data loss' '
206 git add a &&
207 git commit -m C
208 )
205 -'
209 +}
210
211 test_expect_failure 'detect rename/add-source and preserve all data' '
212 + test_setup_break_detection_3 &&
213 (
214 cd break-detection-3 &&
215
@@ -231,6 +236,7 @@ test_expect_failure 'detect rename/add-source and preserve all data' '
236 '
237
238 test_expect_failure 'detect rename/add-source and preserve all data, merge other way' '
239 + test_setup_break_detection_3 &&
240 (
241 cd break-detection-3 &&
242
@@ -256,10 +262,10 @@ test_expect_failure 'detect rename/add-source and preserve all data, merge other
262 )
263 '
264
259 -test_expect_success 'setup content merge + rename/directory conflict' '
260 - test_create_repo rename-directory-1 &&
265 +test_setup_rename_directory () {
266 + test_create_repo rename-directory-$1 &&
267 (
262 - cd rename-directory-1 &&
268 + cd rename-directory-$1 &&
269
270 printf "1\n2\n3\n4\n5\n6\n" >file &&
271 git add file &&
@@ -290,11 +296,12 @@ test_expect_success 'setup content merge + rename/directory conflict' '
296 test_tick &&
297 git commit -m left
298 )
293 -'
299 +}
300
301 test_expect_success 'rename/directory conflict + clean content merge' '
302 + test_setup_rename_directory 1a &&
303 (
297 - cd rename-directory-1 &&
304 + cd rename-directory-1a &&
305
306 git checkout left-clean^0 &&
307
@@ -320,8 +327,9 @@ test_expect_success 'rename/directory conflict + clean content merge' '
327 '
328
329 test_expect_success 'rename/directory conflict + content merge conflict' '
330 + test_setup_rename_directory 1b &&
331 (
324 - cd rename-directory-1 &&
332 + cd rename-directory-1b &&
333
334 git reset --hard &&
335 git clean -fdqx &&
@@ -358,7 +366,7 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
366 )
367 '
368
361 -test_expect_success 'setup content merge + rename/directory conflict w/ disappearing dir' '
369 +test_setup_rename_directory_2 () {
370 test_create_repo rename-directory-2 &&
371 (
372 cd rename-directory-2 &&
@@ -385,9 +393,10 @@ test_expect_success 'setup content merge + rename/directory conflict w/ disappea
393 test_tick &&
394 git commit -m left
395 )
388 -'
396 +}
397
398 test_expect_success 'disappearing dir in rename/directory conflict handled' '
399 + test_setup_rename_directory_2 &&
400 (
401 cd rename-directory-2 &&
402
@@ -416,10 +425,10 @@ test_expect_success 'disappearing dir in rename/directory conflict handled' '
425 # Commit A: rename a->b, modifying b too
426 # Commit B: modify a, add different b
427
419 -test_expect_success 'setup rename-with-content-merge vs. add' '
420 - test_create_repo rename-with-content-merge-and-add &&
428 +test_setup_rename_with_content_merge_and_add () {
429 + test_create_repo rename-with-content-merge-and-add-$1 &&
430 (
422 - cd rename-with-content-merge-and-add &&
431 + cd rename-with-content-merge-and-add-$1 &&
432
433 test_seq 1 5 >a &&
434 git add a &&
@@ -438,11 +447,12 @@ test_expect_success 'setup rename-with-content-merge vs. add' '
447 git add a b &&
448 git commit -m B
449 )
441 -'
450 +}
451
452 test_expect_success 'handle rename-with-content-merge vs. add' '
453 + test_setup_rename_with_content_merge_and_add AB &&
454 (
445 - cd rename-with-content-merge-and-add &&
455 + cd rename-with-content-merge-and-add-AB &&
456
457 git checkout A^0 &&
458
@@ -483,8 +493,9 @@ test_expect_success 'handle rename-with-content-merge vs. add' '
493 '
494
495 test_expect_success 'handle rename-with-content-merge vs. add, merge other way' '
496 + test_setup_rename_with_content_merge_and_add BA &&
497 (
487 - cd rename-with-content-merge-and-add &&
498 + cd rename-with-content-merge-and-add-BA &&
499
500 git reset --hard &&
501 git clean -fdx &&
@@ -539,7 +550,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way'
550 # * The working copy should have two files, both of form c~<unique>; does it?
551 # * Nothing else should be present. Is anything?
552
542 -test_expect_success 'setup rename/rename (2to1) + modify/modify' '
553 +test_setup_rename_rename_2to1 () {
554 test_create_repo rename-rename-2to1 &&
555 (
556 cd rename-rename-2to1 &&
@@ -562,9 +573,10 @@ test_expect_success 'setup rename/rename (2to1) + modify/modify' '
573 git add a &&
574 git commit -m C
575 )
565 -'
576 +}
577
578 test_expect_success 'handle rename/rename (2to1) conflict correctly' '
579 + test_setup_rename_rename_2to1 &&
580 (
581 cd rename-rename-2to1 &&
582
@@ -610,7 +622,7 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' '
622 # Commit A: new file: a
623 # Commit B: rename a->b
624 # Commit C: rename a->c
613 -test_expect_success 'setup simple rename/rename (1to2) conflict' '
625 +test_setup_rename_rename_1to2 () {
626 test_create_repo rename-rename-1to2 &&
627 (
628 cd rename-rename-1to2 &&
@@ -631,9 +643,10 @@ test_expect_success 'setup simple rename/rename (1to2) conflict' '
643 test_tick &&
644 git commit -m C
645 )
634 -'
646 +}
647
648 test_expect_success 'merge has correct working tree contents' '
649 + test_setup_rename_rename_1to2 &&
650 (
651 cd rename-rename-1to2 &&
652
@@ -667,7 +680,7 @@ test_expect_success 'merge has correct working tree contents' '
680 #
681 # Merging of B & C should NOT be clean; there's a rename/rename conflict
682
670 -test_expect_success 'setup rename/rename(1to2)/add-source conflict' '
683 +test_setup_rename_rename_1to2_add_source_1 () {
684 test_create_repo rename-rename-1to2-add-source-1 &&
685 (
686 cd rename-rename-1to2-add-source-1 &&
@@ -687,9 +700,10 @@ test_expect_success 'setup rename/rename(1to2)/add-source conflict' '
700 git add a &&
701 git commit -m C
702 )
690 -'
703 +}
704
705 test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge' '
706 + test_setup_rename_rename_1to2_add_source_1 &&
707 (
708 cd rename-rename-1to2-add-source-1 &&
709
@@ -714,7 +728,7 @@ test_expect_failure 'detect conflict with rename/rename(1to2)/add-source merge'
728 )
729 '
730
717 -test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' '
731 +test_setup_rename_rename_1to2_add_source_2 () {
732 test_create_repo rename-rename-1to2-add-source-2 &&
733 (
734 cd rename-rename-1to2-add-source-2 &&
@@ -737,9 +751,10 @@ test_expect_success 'setup rename/rename(1to2)/add-source resolvable conflict' '
751 test_tick &&
752 git commit -m two
753 )
740 -'
754 +}
755
756 test_expect_failure 'rename/rename/add-source still tracks new a file' '
757 + test_setup_rename_rename_1to2_add_source_2 &&
758 (
759 cd rename-rename-1to2-add-source-2 &&
760
@@ -759,7 +774,7 @@ test_expect_failure 'rename/rename/add-source still tracks new a file' '
774 )
775 '
776
762 -test_expect_success 'setup rename/rename(1to2)/add-dest conflict' '
777 +test_setup_rename_rename_1to2_add_dest () {
778 test_create_repo rename-rename-1to2-add-dest &&
779 (
780 cd rename-rename-1to2-add-dest &&
@@ -784,9 +799,10 @@ test_expect_success 'setup rename/rename(1to2)/add-dest conflict' '
799 test_tick &&
800 git commit -m two
801 )
787 -'
802 +}
803
804 test_expect_success 'rename/rename/add-dest merge still knows about conflicting file versions' '
805 + test_setup_rename_rename_1to2_add_dest &&
806 (
807 cd rename-rename-1to2-add-dest &&
808
@@ -838,7 +854,7 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting
854 # Commit B: rename foo->bar
855 # Expected: CONFLICT (rename/add/delete), two-way merged bar
856
841 -test_expect_success 'rad-setup: rename/add/delete conflict' '
857 +test_setup_rad () {
858 test_create_repo rad &&
859 (
860 cd rad &&
@@ -860,9 +876,10 @@ test_expect_success 'rad-setup: rename/add/delete conflict' '
876 git mv foo bar &&
877 git commit -m "rename foo to bar"
878 )
863 -'
879 +}
880
881 test_expect_failure 'rad-check: rename/add/delete conflict' '
882 + test_setup_rad &&
883 (
884 cd rad &&
885
@@ -904,7 +921,7 @@ test_expect_failure 'rad-check: rename/add/delete conflict' '
921 # Commit B: rename bar->baz, rm foo
922 # Expected: CONFLICT (rename/rename/delete/delete), two-way merged baz
923
907 -test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' '
924 +test_setup_rrdd () {
925 test_create_repo rrdd &&
926 (
927 cd rrdd &&
@@ -927,9 +944,10 @@ test_expect_success 'rrdd-setup: rename/rename(2to1)/delete/delete conflict' '
944 git rm foo &&
945 git commit -m "Rename bar, remove foo"
946 )
930 -'
947 +}
948
949 test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
950 + test_setup_rrdd &&
951 (
952 cd rrdd &&
953
@@ -973,7 +991,7 @@ test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
991 # Expected: six CONFLICT(rename/rename) messages, each path in two of the
992 # multi-way merged contents found in two, four, six
993
976 -test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename(2to1)' '
994 +test_setup_mod6 () {
995 test_create_repo mod6 &&
996 (
997 cd mod6 &&
@@ -1009,9 +1027,10 @@ test_expect_success 'mod6-setup: chains of rename/rename(1to2) and rename/rename
1027 test_tick &&
1028 git commit -m "B"
1029 )
1012 -'
1030 +}
1031
1032 test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
1033 + test_setup_mod6 &&
1034 (
1035 cd mod6 &&
1036
@@ -1108,7 +1127,8 @@ test_conflicts_with_adds_and_renames() {
1127 # files. Is it present?
1128 # 4) There should not be any three~* files in the working
1129 # tree
1111 - test_expect_success "setup simple $sideL/$sideR conflict" '
1130 + test_setup_collision_conflict () {
1131 + #test_expect_success "setup simple $sideL/$sideR conflict" '
1132 test_create_repo simple_${sideL}_${sideR} &&
1133 (
1134 cd simple_${sideL}_${sideR} &&
@@ -1185,9 +1205,11 @@ test_conflicts_with_adds_and_renames() {
1205 fi &&
1206 test_tick && git commit -m R
1207 )
1188 - '
1208 + #'
1209 + }
1210
1211 test_expect_success "check simple $sideL/$sideR conflict" '
1212 + test_setup_collision_conflict &&
1213 (
1214 cd simple_${sideL}_${sideR} &&
1215
@@ -1254,7 +1276,7 @@ test_conflicts_with_adds_and_renames add add
1276 #
1277 # So, we have four different conflicting files that all end up at path
1278 # 'three'.
1257 -test_expect_success 'setup nested conflicts from rename/rename(2to1)' '
1279 +test_setup_nested_conflicts_from_rename_rename () {
1280 test_create_repo nested_conflicts_from_rename_rename &&
1281 (
1282 cd nested_conflicts_from_rename_rename &&
@@ -1305,9 +1327,10 @@ test_expect_success 'setup nested conflicts from rename/rename(2to1)' '
1327 git add one three &&
1328 test_tick && git commit -m german
1329 )
1308 -'
1330 +}
1331
1332 test_expect_success 'check nested conflicts from rename/rename(2to1)' '
1333 + test_setup_nested_conflicts_from_rename_rename &&
1334 (
1335 cd nested_conflicts_from_rename_rename &&
1336
t/t6043-merge-rename-directories.sh
+264 -202
@@ -38,7 +38,7 @@ test_description="recursive merge with directory renames"
38 # Commit B: z/{b,c,d,e/f}
39 # Expected: y/{b,c,d,e/f}
40
41 -test_expect_success '1a-setup: Simple directory rename detection' '
41 +test_setup_1a () {
42 test_create_repo 1a &&
43 (
44 cd 1a &&
@@ -67,9 +67,10 @@ test_expect_success '1a-setup: Simple directory rename detection' '
67 test_tick &&
68 git commit -m "B"
69 )
70 -'
70 +}
71
72 -test_expect_success '1a-check: Simple directory rename detection' '
72 +test_expect_success '1a: Simple directory rename detection' '
73 + test_setup_1a &&
74 (
75 cd 1a &&
76
@@ -103,7 +104,7 @@ test_expect_success '1a-check: Simple directory rename detection' '
104 # Commit B: y/{b,c,d}
105 # Expected: y/{b,c,d,e}
106
106 -test_expect_success '1b-setup: Merge a directory with another' '
107 +test_setup_1b () {
108 test_create_repo 1b &&
109 (
110 cd 1b &&
@@ -134,9 +135,10 @@ test_expect_success '1b-setup: Merge a directory with another' '
135 test_tick &&
136 git commit -m "B"
137 )
137 -'
138 +}
139
139 -test_expect_success '1b-check: Merge a directory with another' '
140 +test_expect_success '1b: Merge a directory with another' '
141 + test_setup_1b &&
142 (
143 cd 1b &&
144
@@ -165,7 +167,7 @@ test_expect_success '1b-check: Merge a directory with another' '
167 # Commit B: z/{b,c,d}
168 # Expected: y/{b,c,d} (because x/d -> z/d -> y/d)
169
168 -test_expect_success '1c-setup: Transitive renaming' '
170 +test_setup_1c () {
171 test_create_repo 1c &&
172 (
173 cd 1c &&
@@ -193,9 +195,10 @@ test_expect_success '1c-setup: Transitive renaming' '
195 test_tick &&
196 git commit -m "B"
197 )
196 -'
198 +}
199
198 -test_expect_success '1c-check: Transitive renaming' '
200 +test_expect_success '1c: Transitive renaming' '
201 + test_setup_1c &&
202 (
203 cd 1c &&
204
@@ -227,7 +230,7 @@ test_expect_success '1c-check: Transitive renaming' '
230 # Note: y/m & z/n should definitely move into x. By the same token, both
231 # y/wham_1 & z/wham_2 should too...giving us a conflict.
232
230 -test_expect_success '1d-setup: Directory renames cause a rename/rename(2to1) conflict' '
233 +test_setup_1d () {
234 test_create_repo 1d &&
235 (
236 cd 1d &&
@@ -262,9 +265,10 @@ test_expect_success '1d-setup: Directory renames cause a rename/rename(2to1) con
265 test_tick &&
266 git commit -m "B"
267 )
265 -'
268 +}
269
267 -test_expect_success '1d-check: Directory renames cause a rename/rename(2to1) conflict' '
270 +test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict' '
271 + test_setup_1d &&
272 (
273 cd 1d &&
274
@@ -313,7 +317,7 @@ test_expect_success '1d-check: Directory renames cause a rename/rename(2to1) con
317 # Commit B: z/{oldb,oldc,d}
318 # Expected: y/{newb,newc,d}
319
316 -test_expect_success '1e-setup: Renamed directory, with all files being renamed too' '
320 +test_setup_1e () {
321 test_create_repo 1e &&
322 (
323 cd 1e &&
@@ -342,9 +346,10 @@ test_expect_success '1e-setup: Renamed directory, with all files being renamed t
346 test_tick &&
347 git commit -m "B"
348 )
345 -'
349 +}
350
347 -test_expect_success '1e-check: Renamed directory, with all files being renamed too' '
351 +test_expect_success '1e: Renamed directory, with all files being renamed too' '
352 + test_setup_1e &&
353 (
354 cd 1e &&
355
@@ -371,7 +376,7 @@ test_expect_success '1e-check: Renamed directory, with all files being renamed t
376 # Commit B: y/{b,c}, x/{d,e,f}
377 # Expected: y/{b,c}, x/{d,e,f,g}
378
374 -test_expect_success '1f-setup: Split a directory into two other directories' '
379 +test_setup_1f () {
380 test_create_repo 1f &&
381 (
382 cd 1f &&
@@ -408,9 +413,10 @@ test_expect_success '1f-setup: Split a directory into two other directories' '
413 test_tick &&
414 git commit -m "B"
415 )
411 -'
416 +}
417
413 -test_expect_success '1f-check: Split a directory into two other directories' '
418 +test_expect_success '1f: Split a directory into two other directories' '
419 + test_setup_1f &&
420 (
421 cd 1f &&
422
@@ -459,7 +465,7 @@ test_expect_success '1f-check: Split a directory into two other directories' '
465 # Commit A: y/b, w/c
466 # Commit B: z/{b,c,d}
467 # Expected: y/b, w/c, z/d, with warning about z/ -> (y/ vs. w/) conflict
462 -test_expect_success '2a-setup: Directory split into two on one side, with equal numbers of paths' '
468 +test_setup_2a () {
469 test_create_repo 2a &&
470 (
471 cd 2a &&
@@ -489,9 +495,10 @@ test_expect_success '2a-setup: Directory split into two on one side, with equal
495 test_tick &&
496 git commit -m "B"
497 )
492 -'
498 +}
499
494 -test_expect_success '2a-check: Directory split into two on one side, with equal numbers of paths' '
500 +test_expect_success '2a: Directory split into two on one side, with equal numbers of paths' '
501 + test_setup_2a &&
502 (
503 cd 2a &&
504
@@ -520,7 +527,7 @@ test_expect_success '2a-check: Directory split into two on one side, with equal
527 # Commit A: y/b, w/c
528 # Commit B: z/{b,c}, x/d
529 # Expected: y/b, w/c, x/d; No warning about z/ -> (y/ vs. w/) conflict
523 -test_expect_success '2b-setup: Directory split into two on one side, with equal numbers of paths' '
530 +test_setup_2b () {
531 test_create_repo 2b &&
532 (
533 cd 2b &&
@@ -551,9 +558,10 @@ test_expect_success '2b-setup: Directory split into two on one side, with equal
558 test_tick &&
559 git commit -m "B"
560 )
554 -'
561 +}
562
556 -test_expect_success '2b-check: Directory split into two on one side, with equal numbers of paths' '
563 +test_expect_success '2b: Directory split into two on one side, with equal numbers of paths' '
564 + test_setup_2b &&
565 (
566 cd 2b &&
567
@@ -601,7 +609,7 @@ test_expect_success '2b-check: Directory split into two on one side, with equal
609 # Commit A: z/{b,c,d} (no change)
610 # Commit B: y/{b,c}, x/d
611 # Expected: y/{b,c}, x/d
604 -test_expect_success '3a-setup: Avoid implicit rename if involved as source on other side' '
612 +test_setup_3a () {
613 test_create_repo 3a &&
614 (
615 cd 3a &&
@@ -632,9 +640,10 @@ test_expect_success '3a-setup: Avoid implicit rename if involved as source on ot
640 test_tick &&
641 git commit -m "B"
642 )
635 -'
643 +}
644
637 -test_expect_success '3a-check: Avoid implicit rename if involved as source on other side' '
645 +test_expect_success '3a: Avoid implicit rename if involved as source on other side' '
646 + test_setup_3a &&
647 (
648 cd 3a &&
649
@@ -664,7 +673,7 @@ test_expect_success '3a-check: Avoid implicit rename if involved as source on ot
673 # get it involved in directory rename detection. If it were, we might
674 # end up with CONFLICT:(z/d -> y/d vs. x/d vs. w/d), i.e. a
675 # rename/rename/rename(1to3) conflict, which is just weird.
667 -test_expect_success '3b-setup: Avoid implicit rename if involved as source on current side' '
676 +test_setup_3b () {
677 test_create_repo 3b &&
678 (
679 cd 3b &&
@@ -697,9 +706,10 @@ test_expect_success '3b-setup: Avoid implicit rename if involved as source on cu
706 test_tick &&
707 git commit -m "B"
708 )
700 -'
709 +}
710
702 -test_expect_success '3b-check: Avoid implicit rename if involved as source on current side' '
711 +test_expect_success '3b: Avoid implicit rename if involved as source on current side' '
712 + test_setup_3b &&
713 (
714 cd 3b &&
715
@@ -786,7 +796,7 @@ test_expect_success '3b-check: Avoid implicit rename if involved as source on cu
796 # Expected: y/{b,c,d}, z/{e,f}
797 # NOTE: Even though most files from z moved to y, we don't want f to follow.
798
789 -test_expect_success '4a-setup: Directory split, with original directory still present' '
799 +test_setup_4a () {
800 test_create_repo 4a &&
801 (
802 cd 4a &&
@@ -818,9 +828,10 @@ test_expect_success '4a-setup: Directory split, with original directory still pr
828 test_tick &&
829 git commit -m "B"
830 )
821 -'
831 +}
832
823 -test_expect_success '4a-check: Directory split, with original directory still present' '
833 +test_expect_success '4a: Directory split, with original directory still present' '
834 + test_setup_4a &&
835 (
836 cd 4a &&
837
@@ -874,7 +885,7 @@ test_expect_success '4a-check: Directory split, with original directory still pr
885 # of history, giving us no way to represent this conflict in the
886 # index.
887
877 -test_expect_success '5a-setup: Merge directories, other side adds files to original and target' '
888 +test_setup_5a () {
889 test_create_repo 5a &&
890 (
891 cd 5a &&
@@ -907,9 +918,10 @@ test_expect_success '5a-setup: Merge directories, other side adds files to origi
918 test_tick &&
919 git commit -m "B"
920 )
910 -'
921 +}
922
912 -test_expect_success '5a-check: Merge directories, other side adds files to original and target' '
923 +test_expect_success '5a: Merge directories, other side adds files to original and target' '
924 + test_setup_5a &&
925 (
926 cd 5a &&
927
@@ -948,7 +960,7 @@ test_expect_success '5a-check: Merge directories, other side adds files to origi
960 # cause us to bail on directory rename detection for that path, falling
961 # back to git behavior without the directory rename detection.
962
951 -test_expect_success '5b-setup: Rename/delete in order to get add/add/add conflict' '
963 +test_setup_5b () {
964 test_create_repo 5b &&
965 (
966 cd 5b &&
@@ -981,9 +993,10 @@ test_expect_success '5b-setup: Rename/delete in order to get add/add/add conflic
993 test_tick &&
994 git commit -m "B"
995 )
984 -'
996 +}
997
986 -test_expect_success '5b-check: Rename/delete in order to get add/add/add conflict' '
998 +test_expect_success '5b: Rename/delete in order to get add/add/add conflict' '
999 + test_setup_5b &&
1000 (
1001 cd 5b &&
1002
@@ -1024,7 +1037,7 @@ test_expect_success '5b-check: Rename/delete in order to get add/add/add conflic
1037 # y/d are y/d_2 and y/d_4. We still do the move from z/e to y/e,
1038 # though, because it doesn't have anything in the way.
1039
1027 -test_expect_success '5c-setup: Transitive rename would cause rename/rename/rename/add/add/add' '
1040 +test_setup_5c () {
1041 test_create_repo 5c &&
1042 (
1043 cd 5c &&
@@ -1061,9 +1074,10 @@ test_expect_success '5c-setup: Transitive rename would cause rename/rename/renam
1074 test_tick &&
1075 git commit -m "B"
1076 )
1064 -'
1077 +}
1078
1066 -test_expect_success '5c-check: Transitive rename would cause rename/rename/rename/add/add/add' '
1079 +test_expect_success '5c: Transitive rename would cause rename/rename/rename/add/add/add' '
1080 + test_setup_5c &&
1081 (
1082 cd 5c &&
1083
@@ -1113,7 +1127,7 @@ test_expect_success '5c-check: Transitive rename would cause rename/rename/renam
1127 # detection for z/d_2, but that doesn't prevent us from applying the
1128 # directory rename detection for z/f -> y/f.
1129
1116 -test_expect_success '5d-setup: Directory/file/file conflict due to directory rename' '
1130 +test_setup_5d () {
1131 test_create_repo 5d &&
1132 (
1133 cd 5d &&
@@ -1145,9 +1159,10 @@ test_expect_success '5d-setup: Directory/file/file conflict due to directory ren
1159 test_tick &&
1160 git commit -m "B"
1161 )
1148 -'
1162 +}
1163
1150 -test_expect_success '5d-check: Directory/file/file conflict due to directory rename' '
1164 +test_expect_success '5d: Directory/file/file conflict due to directory rename' '
1165 + test_setup_5d &&
1166 (
1167 cd 5d &&
1168
@@ -1205,7 +1220,7 @@ test_expect_success '5d-check: Directory/file/file conflict due to directory ren
1220 # them under y/ doesn't accidentally catch z/d and make it look like
1221 # it is also involved in a rename/delete conflict.
1222
1208 -test_expect_success '6a-setup: Tricky rename/delete' '
1223 +test_setup_6a () {
1224 test_create_repo 6a &&
1225 (
1226 cd 6a &&
@@ -1235,9 +1250,10 @@ test_expect_success '6a-setup: Tricky rename/delete' '
1250 test_tick &&
1251 git commit -m "B"
1252 )
1238 -'
1253 +}
1254
1240 -test_expect_success '6a-check: Tricky rename/delete' '
1255 +test_expect_success '6a: Tricky rename/delete' '
1256 + test_setup_6a &&
1257 (
1258 cd 6a &&
1259
@@ -1271,7 +1287,7 @@ test_expect_success '6a-check: Tricky rename/delete' '
1287 # but B did that rename and still decided to put the file into z/,
1288 # so we probably shouldn't apply directory rename detection for it.
1289
1274 -test_expect_success '6b-setup: Same rename done on both sides' '
1290 +test_setup_6b () {
1291 test_create_repo 6b &&
1292 (
1293 cd 6b &&
@@ -1300,9 +1316,10 @@ test_expect_success '6b-setup: Same rename done on both sides' '
1316 test_tick &&
1317 git commit -m "B"
1318 )
1303 -'
1319 +}
1320
1305 -test_expect_success '6b-check: Same rename done on both sides' '
1321 +test_expect_success '6b: Same rename done on both sides' '
1322 + test_setup_6b &&
1323 (
1324 cd 6b &&
1325
@@ -1334,7 +1351,7 @@ test_expect_success '6b-check: Same rename done on both sides' '
1351 # NOTE: Seems obvious, but just checking that the implementation doesn't
1352 # "accidentally detect a rename" and give us y/{b,c,d}.
1353
1337 -test_expect_success '6c-setup: Rename only done on same side' '
1354 +test_setup_6c () {
1355 test_create_repo 6c &&
1356 (
1357 cd 6c &&
@@ -1362,9 +1379,10 @@ test_expect_success '6c-setup: Rename only done on same side' '
1379 test_tick &&
1380 git commit -m "B"
1381 )
1365 -'
1382 +}
1383
1367 -test_expect_success '6c-check: Rename only done on same side' '
1384 +test_expect_success '6c: Rename only done on same side' '
1385 + test_setup_6c &&
1386 (
1387 cd 6c &&
1388
@@ -1396,7 +1414,7 @@ test_expect_success '6c-check: Rename only done on same side' '
1414 # NOTE: Again, this seems obvious but just checking that the implementation
1415 # doesn't "accidentally detect a rename" and give us y/{b,c,d}.
1416
1399 -test_expect_success '6d-setup: We do not always want transitive renaming' '
1417 +test_setup_6d () {
1418 test_create_repo 6d &&
1419 (
1420 cd 6d &&
@@ -1424,9 +1442,10 @@ test_expect_success '6d-setup: We do not always want transitive renaming' '
1442 test_tick &&
1443 git commit -m "B"
1444 )
1427 -'
1445 +}
1446
1429 -test_expect_success '6d-check: We do not always want transitive renaming' '
1447 +test_expect_success '6d: We do not always want transitive renaming' '
1448 + test_setup_6d &&
1449 (
1450 cd 6d &&
1451
@@ -1458,7 +1477,7 @@ test_expect_success '6d-check: We do not always want transitive renaming' '
1477 # doesn't "accidentally detect a rename" and give us y/{b,c} +
1478 # add/add conflict on y/d_1 vs y/d_2.
1479
1461 -test_expect_success '6e-setup: Add/add from one side' '
1480 +test_setup_6e () {
1481 test_create_repo 6e &&
1482 (
1483 cd 6e &&
@@ -1487,9 +1506,10 @@ test_expect_success '6e-setup: Add/add from one side' '
1506 test_tick &&
1507 git commit -m "B"
1508 )
1490 -'
1509 +}
1510
1492 -test_expect_success '6e-check: Add/add from one side' '
1511 +test_expect_success '6e: Add/add from one side' '
1512 + test_setup_6e &&
1513 (
1514 cd 6e &&
1515
@@ -1552,7 +1572,7 @@ test_expect_success '6e-check: Add/add from one side' '
1572 # Expected: y/d, CONFLICT(rename/rename for both z/b and z/c)
1573 # NOTE: There's a rename of z/ here, y/ has more renames, so z/d -> y/d.
1574
1555 -test_expect_success '7a-setup: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' '
1575 +test_setup_7a () {
1576 test_create_repo 7a &&
1577 (
1578 cd 7a &&
@@ -1583,9 +1603,10 @@ test_expect_success '7a-setup: rename-dir vs. rename-dir (NOT split evenly) PLUS
1603 test_tick &&
1604 git commit -m "B"
1605 )
1586 -'
1606 +}
1607
1588 -test_expect_success '7a-check: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' '
1608 +test_expect_success '7a: rename-dir vs. rename-dir (NOT split evenly) PLUS add-other-file' '
1609 + test_setup_7a &&
1610 (
1611 cd 7a &&
1612
@@ -1623,7 +1644,7 @@ test_expect_success '7a-check: rename-dir vs. rename-dir (NOT split evenly) PLUS
1644 # Commit B: z/{b,c,d_1}, w/d_2
1645 # Expected: y/{b,c}, CONFLICT(rename/rename(2to1): x/d_1, w/d_2 -> y_d)
1646
1626 -test_expect_success '7b-setup: rename/rename(2to1), but only due to transitive rename' '
1647 +test_setup_7b () {
1648 test_create_repo 7b &&
1649 (
1650 cd 7b &&
@@ -1655,9 +1676,10 @@ test_expect_success '7b-setup: rename/rename(2to1), but only due to transitive r
1676 test_tick &&
1677 git commit -m "B"
1678 )
1658 -'
1679 +}
1680
1660 -test_expect_success '7b-check: rename/rename(2to1), but only due to transitive rename' '
1681 +test_expect_success '7b: rename/rename(2to1), but only due to transitive rename' '
1682 + test_setup_7b &&
1683 (
1684 cd 7b &&
1685
@@ -1702,7 +1724,7 @@ test_expect_success '7b-check: rename/rename(2to1), but only due to transitive r
1724 # neither CONFLICT(x/d -> w/d vs. z/d)
1725 # nor CONFLiCT x/d -> w/d vs. y/d vs. z/d)
1726
1705 -test_expect_success '7c-setup: rename/rename(1to...2or3); transitive rename may add complexity' '
1727 +test_setup_7c () {
1728 test_create_repo 7c &&
1729 (
1730 cd 7c &&
@@ -1732,9 +1754,10 @@ test_expect_success '7c-setup: rename/rename(1to...2or3); transitive rename may
1754 test_tick &&
1755 git commit -m "B"
1756 )
1735 -'
1757 +}
1758
1737 -test_expect_success '7c-check: rename/rename(1to...2or3); transitive rename may add complexity' '
1759 +test_expect_success '7c: rename/rename(1to...2or3); transitive rename may add complexity' '
1760 + test_setup_7c &&
1761 (
1762 cd 7c &&
1763
@@ -1766,7 +1789,7 @@ test_expect_success '7c-check: rename/rename(1to...2or3); transitive rename may
1789 # Expected: y/{b,c}, CONFLICT(delete x/d vs rename to y/d)
1790 # NOTE: z->y so NOT CONFLICT(delete x/d vs rename to z/d)
1791
1769 -test_expect_success '7d-setup: transitive rename involved in rename/delete; how is it reported?' '
1792 +test_setup_7d () {
1793 test_create_repo 7d &&
1794 (
1795 cd 7d &&
@@ -1796,9 +1819,10 @@ test_expect_success '7d-setup: transitive rename involved in rename/delete; how
1819 test_tick &&
1820 git commit -m "B"
1821 )
1799 -'
1822 +}
1823
1801 -test_expect_success '7d-check: transitive rename involved in rename/delete; how is it reported?' '
1824 +test_expect_success '7d: transitive rename involved in rename/delete; how is it reported?' '
1825 + test_setup_7d &&
1826 (
1827 cd 7d &&
1828
@@ -1851,7 +1875,7 @@ test_expect_success '7d-check: transitive rename involved in rename/delete; how
1875 # see testcases 9c and 9d for further discussion of this issue and
1876 # how it's resolved.
1877
1854 -test_expect_success '7e-setup: transitive rename in rename/delete AND dirs in the way' '
1878 +test_setup_7e () {
1879 test_create_repo 7e &&
1880 (
1881 cd 7e &&
@@ -1886,9 +1910,10 @@ test_expect_success '7e-setup: transitive rename in rename/delete AND dirs in th
1910 test_tick &&
1911 git commit -m "B"
1912 )
1889 -'
1913 +}
1914
1891 -test_expect_success '7e-check: transitive rename in rename/delete AND dirs in the way' '
1915 +test_expect_success '7e: transitive rename in rename/delete AND dirs in the way' '
1916 + test_setup_7e &&
1917 (
1918 cd 7e &&
1919
@@ -1945,7 +1970,7 @@ test_expect_success '7e-check: transitive rename in rename/delete AND dirs in th
1970 # simple rule from section 5 prevents me from handling this as optimally as
1971 # we potentially could.
1972
1948 -test_expect_success '8a-setup: Dual-directory rename, one into the others way' '
1973 +test_setup_8a () {
1974 test_create_repo 8a &&
1975 (
1976 cd 8a &&
@@ -1977,9 +2002,10 @@ test_expect_success '8a-setup: Dual-directory rename, one into the others way' '
2002 test_tick &&
2003 git commit -m "B"
2004 )
1980 -'
2005 +}
2006
1982 -test_expect_success '8a-check: Dual-directory rename, one into the others way' '
2007 +test_expect_success '8a: Dual-directory rename, one into the others way' '
2008 + test_setup_8a &&
2009 (
2010 cd 8a &&
2011
@@ -2023,7 +2049,7 @@ test_expect_success '8a-check: Dual-directory rename, one into the others way' '
2049 # making us fall back to pre-directory-rename-detection behavior for both
2050 # e_1 and e_2.
2051
2026 -test_expect_success '8b-setup: Dual-directory rename, one into the others way, with conflicting filenames' '
2052 +test_setup_8b () {
2053 test_create_repo 8b &&
2054 (
2055 cd 8b &&
@@ -2055,9 +2081,10 @@ test_expect_success '8b-setup: Dual-directory rename, one into the others way, w
2081 test_tick &&
2082 git commit -m "B"
2083 )
2058 -'
2084 +}
2085
2060 -test_expect_success '8b-check: Dual-directory rename, one into the others way, with conflicting filenames' '
2086 +test_expect_success '8b: Dual-directory rename, one into the others way, with conflicting filenames' '
2087 + test_setup_8b &&
2088 (
2089 cd 8b &&
2090
@@ -2096,7 +2123,7 @@ test_expect_success '8b-check: Dual-directory rename, one into the others way, w
2123 # rename/rename(1to2) conflicts -- see testcase 9h. See also
2124 # notes in 8d.
2125
2099 -test_expect_success '8c-setup: modify/delete or rename+modify/delete?' '
2126 +test_setup_8c () {
2127 test_create_repo 8c &&
2128 (
2129 cd 8c &&
@@ -2127,9 +2154,10 @@ test_expect_success '8c-setup: modify/delete or rename+modify/delete?' '
2154 test_tick &&
2155 git commit -m "B"
2156 )
2130 -'
2157 +}
2158
2132 -test_expect_success '8c-check: modify/delete or rename+modify/delete' '
2159 +test_expect_success '8c: modify/delete or rename+modify/delete' '
2160 + test_setup_8c &&
2161 (
2162 cd 8c &&
2163
@@ -2175,7 +2203,7 @@ test_expect_success '8c-check: modify/delete or rename+modify/delete' '
2203 # during merging are supposed to be about opposite sides doing things
2204 # differently.
2205
2178 -test_expect_success '8d-setup: rename/delete...or not?' '
2206 +test_setup_8d () {
2207 test_create_repo 8d &&
2208 (
2209 cd 8d &&
@@ -2204,9 +2232,10 @@ test_expect_success '8d-setup: rename/delete...or not?' '
2232 test_tick &&
2233 git commit -m "B"
2234 )
2207 -'
2235 +}
2236
2209 -test_expect_success '8d-check: rename/delete...or not?' '
2237 +test_expect_success '8d: rename/delete...or not?' '
2238 + test_setup_8d &&
2239 (
2240 cd 8d &&
2241
@@ -2250,7 +2279,7 @@ test_expect_success '8d-check: rename/delete...or not?' '
2279 # about the ramifications of doing that, I didn't know how to rule out
2280 # that opening other weird edge and corner cases so I just punted.
2281
2253 -test_expect_success '8e-setup: Both sides rename, one side adds to original directory' '
2282 +test_setup_8e () {
2283 test_create_repo 8e &&
2284 (
2285 cd 8e &&
@@ -2279,9 +2308,10 @@ test_expect_success '8e-setup: Both sides rename, one side adds to original dire
2308 test_tick &&
2309 git commit -m "B"
2310 )
2282 -'
2311 +}
2312
2284 -test_expect_success '8e-check: Both sides rename, one side adds to original directory' '
2313 +test_expect_success '8e: Both sides rename, one side adds to original directory' '
2314 + test_setup_8e &&
2315 (
2316 cd 8e &&
2317
@@ -2333,7 +2363,7 @@ test_expect_success '8e-check: Both sides rename, one side adds to original dire
2363 # of which one had the most paths going to it. A naive implementation
2364 # of that could take the new file in commit B at z/i to x/w/i or x/i.
2365
2336 -test_expect_success '9a-setup: Inner renamed directory within outer renamed directory' '
2366 +test_setup_9a () {
2367 test_create_repo 9a &&
2368 (
2369 cd 9a &&
@@ -2366,9 +2396,10 @@ test_expect_success '9a-setup: Inner renamed directory within outer renamed dire
2396 test_tick &&
2397 git commit -m "B"
2398 )
2369 -'
2399 +}
2400
2371 -test_expect_success '9a-check: Inner renamed directory within outer renamed directory' '
2401 +test_expect_success '9a: Inner renamed directory within outer renamed directory' '
2402 + test_setup_9a &&
2403 (
2404 cd 9a &&
2405
@@ -2404,7 +2435,7 @@ test_expect_success '9a-check: Inner renamed directory within outer renamed dire
2435 # Commit B: z/{b,c,d_3}
2436 # Expected: y/{b,c,d_merged}
2437
2407 -test_expect_success '9b-setup: Transitive rename with content merge' '
2438 +test_setup_9b () {
2439 test_create_repo 9b &&
2440 (
2441 cd 9b &&
@@ -2436,9 +2467,10 @@ test_expect_success '9b-setup: Transitive rename with content merge' '
2467 test_tick &&
2468 git commit -m "B"
2469 )
2439 -'
2470 +}
2471
2441 -test_expect_success '9b-check: Transitive rename with content merge' '
2472 +test_expect_success '9b: Transitive rename with content merge' '
2473 + test_setup_9b &&
2474 (
2475 cd 9b &&
2476
@@ -2491,7 +2523,7 @@ test_expect_success '9b-check: Transitive rename with content merge' '
2523 # away, then ignore that particular rename from the other side of
2524 # history for any implicit directory renames.
2525
2494 -test_expect_success '9c-setup: Doubly transitive rename?' '
2526 +test_setup_9c () {
2527 test_create_repo 9c &&
2528 (
2529 cd 9c &&
@@ -2526,9 +2558,10 @@ test_expect_success '9c-setup: Doubly transitive rename?' '
2558 test_tick &&
2559 git commit -m "B"
2560 )
2529 -'
2561 +}
2562
2531 -test_expect_success '9c-check: Doubly transitive rename?' '
2563 +test_expect_success '9c: Doubly transitive rename?' '
2564 + test_setup_9c &&
2565 (
2566 cd 9c &&
2567
@@ -2579,7 +2612,7 @@ test_expect_success '9c-check: Doubly transitive rename?' '
2612 # simple rules that are consistent with what we need for all the other
2613 # testcases and simplifies things for the user.
2614
2582 -test_expect_success '9d-setup: N-way transitive rename?' '
2615 +test_setup_9d () {
2616 test_create_repo 9d &&
2617 (
2618 cd 9d &&
@@ -2614,9 +2647,10 @@ test_expect_success '9d-setup: N-way transitive rename?' '
2647 test_tick &&
2648 git commit -m "B"
2649 )
2617 -'
2650 +}
2651
2619 -test_expect_success '9d-check: N-way transitive rename?' '
2652 +test_expect_success '9d: N-way transitive rename?' '
2653 + test_setup_9d &&
2654 (
2655 cd 9d &&
2656
@@ -2653,7 +2687,7 @@ test_expect_success '9d-check: N-way transitive rename?' '
2687 # Expected: combined/{a,b,c,d,e,f,g,h,i,j,k,l}, CONFLICT(Nto1) warnings,
2688 # dir1/yo, dir2/yo, dir3/yo, dirN/yo
2689
2656 -test_expect_success '9e-setup: N-to-1 whammo' '
2690 +test_setup_9e () {
2691 test_create_repo 9e &&
2692 (
2693 cd 9e &&
@@ -2696,9 +2730,10 @@ test_expect_success '9e-setup: N-to-1 whammo' '
2730 test_tick &&
2731 git commit -m "B"
2732 )
2699 -'
2733 +}
2734
2701 -test_expect_success C_LOCALE_OUTPUT '9e-check: N-to-1 whammo' '
2735 +test_expect_success C_LOCALE_OUTPUT '9e: N-to-1 whammo' '
2736 + test_setup_9e &&
2737 (
2738 cd 9e &&
2739
@@ -2745,7 +2780,7 @@ test_expect_success C_LOCALE_OUTPUT '9e-check: N-to-1 whammo' '
2780 # Commit B: goal/{a,b}/$more_files, goal/c
2781 # Expected: priority/{a,b}/$more_files, priority/c
2782
2748 -test_expect_success '9f-setup: Renamed directory that only contained immediate subdirs' '
2783 +test_setup_9f () {
2784 test_create_repo 9f &&
2785 (
2786 cd 9f &&
@@ -2774,9 +2809,10 @@ test_expect_success '9f-setup: Renamed directory that only contained immediate s
2809 test_tick &&
2810 git commit -m "B"
2811 )
2777 -'
2812 +}
2813
2779 -test_expect_success '9f-check: Renamed directory that only contained immediate subdirs' '
2814 +test_expect_success '9f: Renamed directory that only contained immediate subdirs' '
2815 + test_setup_9f &&
2816 (
2817 cd 9f &&
2818
@@ -2809,7 +2845,7 @@ test_expect_success '9f-check: Renamed directory that only contained immediate s
2845 # Commit B: goal/{a,b}/$more_files, goal/c
2846 # Expected: priority/{alpha,bravo}/$more_files, priority/c
2847
2812 -test_expect_success '9g-setup: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
2848 +test_setup_9g () {
2849 test_create_repo 9g &&
2850 (
2851 cd 9g &&
@@ -2841,9 +2877,9 @@ test_expect_success '9g-setup: Renamed directory that only contained immediate s
2877 test_tick &&
2878 git commit -m "B"
2879 )
2844 -'
2880 +}
2881
2846 -test_expect_failure '9g-check: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
2882 +test_expect_failure '9g: Renamed directory that only contained immediate subdirs, immediate subdirs renamed' '
2883 (
2884 cd 9g &&
2885
@@ -2877,7 +2913,7 @@ test_expect_failure '9g-check: Renamed directory that only contained immediate s
2913 # Expected: y/{b,c}, x/d_2
2914 # NOTE: If we applied the z/ -> y/ rename to z/d, then we'd end up with
2915 # a rename/rename(1to2) conflict (z/d -> y/d vs. x/d)
2880 -test_expect_success '9h-setup: Avoid dir rename on merely modified path' '
2916 +test_setup_9h () {
2917 test_create_repo 9h &&
2918 (
2919 cd 9h &&
@@ -2910,9 +2946,10 @@ test_expect_success '9h-setup: Avoid dir rename on merely modified path' '
2946 test_tick &&
2947 git commit -m "B"
2948 )
2913 -'
2949 +}
2950
2915 -test_expect_success '9h-check: Avoid dir rename on merely modified path' '
2951 +test_expect_success '9h: Avoid dir rename on merely modified path' '
2952 + test_setup_9h &&
2953 (
2954 cd 9h &&
2955
@@ -2957,7 +2994,7 @@ test_expect_success '9h-check: Avoid dir rename on merely modified path' '
2994 # Expected: Aborted Merge +
2995 # ERROR_MSG(untracked working tree files would be overwritten by merge)
2996
2960 -test_expect_success '10a-setup: Overwrite untracked with normal rename/delete' '
2997 +test_setup_10a () {
2998 test_create_repo 10a &&
2999 (
3000 cd 10a &&
@@ -2983,9 +3020,10 @@ test_expect_success '10a-setup: Overwrite untracked with normal rename/delete' '
3020 test_tick &&
3021 git commit -m "B"
3022 )
2986 -'
3023 +}
3024
2988 -test_expect_success '10a-check: Overwrite untracked with normal rename/delete' '
3025 +test_expect_success '10a: Overwrite untracked with normal rename/delete' '
3026 + test_setup_10a &&
3027 (
3028 cd 10a &&
3029
@@ -3021,7 +3059,7 @@ test_expect_success '10a-check: Overwrite untracked with normal rename/delete' '
3059 # z/c_1 -> z/d_1 rename recorded at stage 3 for y/d +
3060 # ERROR_MSG(refusing to lose untracked file at 'y/d')
3061
3024 -test_expect_success '10b-setup: Overwrite untracked with dir rename + delete' '
3062 +test_setup_10b () {
3063 test_create_repo 10b &&
3064 (
3065 cd 10b &&
@@ -3050,9 +3088,10 @@ test_expect_success '10b-setup: Overwrite untracked with dir rename + delete' '
3088 test_tick &&
3089 git commit -m "B"
3090 )
3053 -'
3091 +}
3092
3055 -test_expect_success '10b-check: Overwrite untracked with dir rename + delete' '
3093 +test_expect_success '10b: Overwrite untracked with dir rename + delete' '
3094 + test_setup_10b &&
3095 (
3096 cd 10b &&
3097
@@ -3098,10 +3137,10 @@ test_expect_success '10b-check: Overwrite untracked with dir rename + delete' '
3137 # y/c~B^0 +
3138 # ERROR_MSG(Refusing to lose untracked file at y/c)
3139
3101 -test_expect_success '10c-setup: Overwrite untracked with dir rename/rename(1to2)' '
3102 - test_create_repo 10c &&
3140 +test_setup_10c () {
3141 + test_create_repo 10c_$1 &&
3142 (
3104 - cd 10c &&
3143 + cd 10c_$1 &&
3144
3145 mkdir z x &&
3146 echo a >z/a &&
@@ -3128,11 +3167,12 @@ test_expect_success '10c-setup: Overwrite untracked with dir rename/rename(1to2)
3167 test_tick &&
3168 git commit -m "B"
3169 )
3131 -'
3170 +}
3171
3133 -test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2)' '
3172 +test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' '
3173 + test_setup_10c 1 &&
3174 (
3135 - cd 10c &&
3175 + cd 10c_1 &&
3176
3177 git checkout A^0 &&
3178 echo important >y/c &&
@@ -3163,9 +3203,10 @@ test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2)
3203 )
3204 '
3205
3166 -test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2), other direction' '
3206 +test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), other direction' '
3207 + test_setup_10c 2 &&
3208 (
3168 - cd 10c &&
3209 + cd 10c_2 &&
3210
3211 git reset --hard &&
3212 git clean -fdqx &&
@@ -3208,7 +3249,7 @@ test_expect_success '10c-check: Overwrite untracked with dir rename/rename(1to2)
3249 # CONFLICT(rename/rename) z/c_1 vs x/f_2 -> y/wham
3250 # ERROR_MSG(Refusing to lose untracked file at y/wham)
3251
3211 -test_expect_success '10d-setup: Delete untracked with dir rename/rename(2to1)' '
3252 +test_setup_10d () {
3253 test_create_repo 10d &&
3254 (
3255 cd 10d &&
@@ -3240,9 +3281,10 @@ test_expect_success '10d-setup: Delete untracked with dir rename/rename(2to1)' '
3281 test_tick &&
3282 git commit -m "B"
3283 )
3243 -'
3284 +}
3285
3245 -test_expect_success '10d-check: Delete untracked with dir rename/rename(2to1)' '
3286 +test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' '
3287 + test_setup_10d &&
3288 (
3289 cd 10d &&
3290
@@ -3290,7 +3332,7 @@ test_expect_success '10d-check: Delete untracked with dir rename/rename(2to1)' '
3332 # Commit B: z/{a,b,c}
3333 # Expected: y/{a,b,c} + untracked z/c
3334
3293 -test_expect_success '10e-setup: Does git complain about untracked file that is not really in the way?' '
3335 +test_setup_10e () {
3336 test_create_repo 10e &&
3337 (
3338 cd 10e &&
@@ -3317,9 +3359,9 @@ test_expect_success '10e-setup: Does git complain about untracked file that is n
3359 test_tick &&
3360 git commit -m "B"
3361 )
3320 -'
3362 +}
3363
3322 -test_expect_failure '10e-check: Does git complain about untracked file that is not really in the way?' '
3364 +test_expect_failure '10e: Does git complain about untracked file that is not really in the way?' '
3365 (
3366 cd 10e &&
3367
@@ -3371,7 +3413,7 @@ test_expect_failure '10e-check: Does git complain about untracked file that is n
3413 # z/c~HEAD with contents of B:z/b_v2,
3414 # z/c with uncommitted mods on top of A:z/c_v1
3415
3374 -test_expect_success '11a-setup: Avoid losing dirty contents with simple rename' '
3416 +test_setup_11a () {
3417 test_create_repo 11a &&
3418 (
3419 cd 11a &&
@@ -3398,9 +3440,10 @@ test_expect_success '11a-setup: Avoid losing dirty contents with simple rename'
3440 test_tick &&
3441 git commit -m "B"
3442 )
3401 -'
3443 +}
3444
3403 -test_expect_success '11a-check: Avoid losing dirty contents with simple rename' '
3445 +test_expect_success '11a: Avoid losing dirty contents with simple rename' '
3446 + test_setup_11a &&
3447 (
3448 cd 11a &&
3449
@@ -3441,7 +3484,7 @@ test_expect_success '11a-check: Avoid losing dirty contents with simple rename'
3484 # ERROR_MSG(Refusing to lose dirty file at z/c)
3485
3486
3444 -test_expect_success '11b-setup: Avoid losing dirty file involved in directory rename' '
3487 +test_setup_11b () {
3488 test_create_repo 11b &&
3489 (
3490 cd 11b &&
@@ -3470,9 +3513,10 @@ test_expect_success '11b-setup: Avoid losing dirty file involved in directory re
3513 test_tick &&
3514 git commit -m "B"
3515 )
3473 -'
3516 +}
3517
3475 -test_expect_success '11b-check: Avoid losing dirty file involved in directory rename' '
3518 +test_expect_success '11b: Avoid losing dirty file involved in directory rename' '
3519 + test_setup_11b &&
3520 (
3521 cd 11b &&
3522
@@ -3515,7 +3559,7 @@ test_expect_success '11b-check: Avoid losing dirty file involved in directory re
3559 # Expected: Abort_msg("following files would be overwritten by merge") +
3560 # y/c left untouched (still has uncommitted mods)
3561
3518 -test_expect_success '11c-setup: Avoid losing not-uptodate with rename + D/F conflict' '
3562 +test_setup_11c () {
3563 test_create_repo 11c &&
3564 (
3565 cd 11c &&
@@ -3545,9 +3589,10 @@ test_expect_success '11c-setup: Avoid losing not-uptodate with rename + D/F conf
3589 test_tick &&
3590 git commit -m "B"
3591 )
3548 -'
3592 +}
3593
3550 -test_expect_success '11c-check: Avoid losing not-uptodate with rename + D/F conflict' '
3594 +test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict' '
3595 + test_setup_11c &&
3596 (
3597 cd 11c &&
3598
@@ -3581,7 +3626,7 @@ test_expect_success '11c-check: Avoid losing not-uptodate with rename + D/F conf
3626 # Warning_Msg("Refusing to lose dirty file at z/c) +
3627 # y/{a,c~HEAD,c/d}, x/b, now-untracked z/c_v1 with uncommitted mods
3628
3584 -test_expect_success '11d-setup: Avoid losing not-uptodate with rename + D/F conflict' '
3629 +test_setup_11d () {
3630 test_create_repo 11d &&
3631 (
3632 cd 11d &&
@@ -3612,9 +3657,10 @@ test_expect_success '11d-setup: Avoid losing not-uptodate with rename + D/F conf
3657 test_tick &&
3658 git commit -m "B"
3659 )
3615 -'
3660 +}
3661
3617 -test_expect_success '11d-check: Avoid losing not-uptodate with rename + D/F conflict' '
3662 +test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict' '
3663 + test_setup_11d &&
3664 (
3665 cd 11d &&
3666
@@ -3659,7 +3705,7 @@ test_expect_success '11d-check: Avoid losing not-uptodate with rename + D/F conf
3705 # y/c~HEAD has A:y/c_2 contents
3706 # y/c has dirty file from before merge
3707
3662 -test_expect_success '11e-setup: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' '
3708 +test_setup_11e () {
3709 test_create_repo 11e &&
3710 (
3711 cd 11e &&
@@ -3691,9 +3737,10 @@ test_expect_success '11e-setup: Avoid deleting not-uptodate with dir rename/rena
3737 test_tick &&
3738 git commit -m "B"
3739 )
3694 -'
3740 +}
3741
3696 -test_expect_success '11e-check: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' '
3742 +test_expect_success '11e: Avoid deleting not-uptodate with dir rename/rename(1to2)/add' '
3743 + test_setup_11e &&
3744 (
3745 cd 11e &&
3746
@@ -3744,7 +3791,7 @@ test_expect_success '11e-check: Avoid deleting not-uptodate with dir rename/rena
3791 # CONFLICT(rename/rename) x/c vs x/d -> y/wham
3792 # ERROR_MSG(Refusing to lose dirty file at y/wham)
3793
3747 -test_expect_success '11f-setup: Avoid deleting not-uptodate with dir rename/rename(2to1)' '
3794 +test_setup_11f () {
3795 test_create_repo 11f &&
3796 (
3797 cd 11f &&
@@ -3773,9 +3820,10 @@ test_expect_success '11f-setup: Avoid deleting not-uptodate with dir rename/rena
3820 test_tick &&
3821 git commit -m "B"
3822 )
3776 -'
3823 +}
3824
3778 -test_expect_success '11f-check: Avoid deleting not-uptodate with dir rename/rename(2to1)' '
3825 +test_expect_success '11f: Avoid deleting not-uptodate with dir rename/rename(2to1)' '
3826 + test_setup_11f &&
3827 (
3828 cd 11f &&
3829
@@ -3832,7 +3880,7 @@ test_expect_success '11f-check: Avoid deleting not-uptodate with dir rename/rena
3880 # Commit B: node1/{leaf1,leaf2,leaf5}, node2/{leaf3,leaf4,leaf6}
3881 # Expected: node1/{leaf1,leaf2,leaf5,node2/{leaf3,leaf4,leaf6}}
3882
3835 -test_expect_success '12a-setup: Moving one directory hierarchy into another' '
3883 +test_setup_12a () {
3884 test_create_repo 12a &&
3885 (
3886 cd 12a &&
@@ -3862,9 +3910,10 @@ test_expect_success '12a-setup: Moving one directory hierarchy into another' '
3910 test_tick &&
3911 git commit -m "B"
3912 )
3865 -'
3913 +}
3914
3867 -test_expect_success '12a-check: Moving one directory hierarchy into another' '
3915 +test_expect_success '12a: Moving one directory hierarchy into another' '
3916 + test_setup_12a &&
3917 (
3918 cd 12a &&
3919
@@ -3910,7 +3959,7 @@ test_expect_success '12a-check: Moving one directory hierarchy into another' '
3959 # To which, I can do no more than shrug my shoulders and say that
3960 # even simple rules give weird results when given weird inputs.
3961
3913 -test_expect_success '12b-setup: Moving two directory hierarchies into each other' '
3962 +test_setup_12b () {
3963 test_create_repo 12b &&
3964 (
3965 cd 12b &&
@@ -3938,9 +3987,10 @@ test_expect_success '12b-setup: Moving two directory hierarchies into each other
3987 test_tick &&
3988 git commit -m "B"
3989 )
3941 -'
3990 +}
3991
3943 -test_expect_success '12b-check: Moving two directory hierarchies into each other' '
3992 +test_expect_success '12b: Moving two directory hierarchies into each other' '
3993 + test_setup_12b &&
3994 (
3995 cd 12b &&
3996
@@ -3976,7 +4026,7 @@ test_expect_success '12b-check: Moving two directory hierarchies into each other
4026 # NOTE: This is *exactly* like 12c, except that every path is modified on
4027 # each side of the merge.
4028
3979 -test_expect_success '12c-setup: Moving one directory hierarchy into another w/ content merge' '
4029 +test_setup_12c () {
4030 test_create_repo 12c &&
4031 (
4032 cd 12c &&
@@ -4008,9 +4058,10 @@ test_expect_success '12c-setup: Moving one directory hierarchy into another w/ c
4058 test_tick &&
4059 git commit -m "B"
4060 )
4011 -'
4061 +}
4062
4013 -test_expect_success '12c-check: Moving one directory hierarchy into another w/ content merge' '
4063 +test_expect_success '12c: Moving one directory hierarchy into another w/ content merge' '
4064 + test_setup_12c &&
4065 (
4066 cd 12c &&
4067
@@ -4057,7 +4108,7 @@ test_expect_success '12c-check: Moving one directory hierarchy into another w/ c
4108 # Commit B: a/b/subdir/foo, a/b/bar
4109 # Expected: subdir/foo, bar
4110
4060 -test_expect_success '12d-setup: Rename/merge subdir into the root, variant 1' '
4111 +test_setup_12d () {
4112 test_create_repo 12d &&
4113 (
4114 cd 12d &&
@@ -4078,9 +4129,10 @@ test_expect_success '12d-setup: Rename/merge subdir into the root, variant 1' '
4129 git checkout B &&
4130 test_commit a/b/bar
4131 )
4081 -'
4132 +}
4133
4083 -test_expect_success '12d-check: Rename/merge subdir into the root, variant 1' '
4134 +test_expect_success '12d: Rename/merge subdir into the root, variant 1' '
4135 + test_setup_12d &&
4136 (
4137 cd 12d &&
4138
@@ -4114,7 +4166,7 @@ test_expect_success '12d-check: Rename/merge subdir into the root, variant 1' '
4166 # Commit B: a/b/foo, a/b/bar
4167 # Expected: foo, bar
4168
4117 -test_expect_success '12e-setup: Rename/merge subdir into the root, variant 2' '
4169 +test_setup_12e () {
4170 test_create_repo 12e &&
4171 (
4172 cd 12e &&
@@ -4135,9 +4187,10 @@ test_expect_success '12e-setup: Rename/merge subdir into the root, variant 2' '
4187 git checkout B &&
4188 test_commit a/b/bar
4189 )
4138 -'
4190 +}
4191
4140 -test_expect_success '12e-check: Rename/merge subdir into the root, variant 2' '
4192 +test_expect_success '12e: Rename/merge subdir into the root, variant 2' '
4193 + test_setup_12e &&
4194 (
4195 cd 12e &&
4196
@@ -4182,10 +4235,10 @@ test_expect_success '12e-check: Rename/merge subdir into the root, variant 2' '
4235 # Commit B: z/{b,c,d,e/f}
4236 # Expected: y/{b,c,d,e/f}, with notices/conflicts for both y/d and y/e/f
4237
4185 -test_expect_success '13a-setup: messages for newly added files' '
4186 - test_create_repo 13a &&
4238 +test_setup_13a () {
4239 + test_create_repo 13a_$1 &&
4240 (
4188 - cd 13a &&
4241 + cd 13a_$1 &&
4242
4243 mkdir z &&
4244 echo b >z/b &&
@@ -4211,11 +4264,12 @@ test_expect_success '13a-setup: messages for newly added files' '
4264 test_tick &&
4265 git commit -m "B"
4266 )
4214 -'
4267 +}
4268
4216 -test_expect_success '13a-check(conflict): messages for newly added files' '
4269 +test_expect_success '13a(conflict): messages for newly added files' '
4270 + test_setup_13a conflict &&
4271 (
4218 - cd 13a &&
4272 + cd 13a_conflict &&
4273
4274 git checkout A^0 &&
4275
@@ -4235,9 +4289,10 @@ test_expect_success '13a-check(conflict): messages for newly added files' '
4289 )
4290 '
4291
4238 -test_expect_success '13a-check(info): messages for newly added files' '
4292 +test_expect_success '13a(info): messages for newly added files' '
4293 + test_setup_13a info &&
4294 (
4240 - cd 13a &&
4295 + cd 13a_info &&
4296
4297 git reset --hard &&
4298 git checkout A^0 &&
@@ -4267,10 +4322,10 @@ test_expect_success '13a-check(info): messages for newly added files' '
4322 # Expected: y/{b,c,d_merged}, with two conflict messages for y/d,
4323 # one about content, and one about file location
4324
4270 -test_expect_success '13b-setup: messages for transitive rename with conflicted content' '
4271 - test_create_repo 13b &&
4325 +test_setup_13b () {
4326 + test_create_repo 13b_$1 &&
4327 (
4273 - cd 13b &&
4328 + cd 13b_$1 &&
4329
4330 mkdir x &&
4331 mkdir z &&
@@ -4299,11 +4354,12 @@ test_expect_success '13b-setup: messages for transitive rename with conflicted c
4354 test_tick &&
4355 git commit -m "B"
4356 )
4302 -'
4357 +}
4358
4304 -test_expect_success '13b-check(conflict): messages for transitive rename with conflicted content' '
4359 +test_expect_success '13b(conflict): messages for transitive rename with conflicted content' '
4360 + test_setup_13b conflict &&
4361 (
4306 - cd 13b &&
4362 + cd 13b_conflict &&
4363
4364 git checkout A^0 &&
4365
@@ -4321,9 +4377,10 @@ test_expect_success '13b-check(conflict): messages for transitive rename with co
4377 )
4378 '
4379
4324 -test_expect_success '13b-check(info): messages for transitive rename with conflicted content' '
4380 +test_expect_success '13b(info): messages for transitive rename with conflicted content' '
4381 + test_setup_13b info &&
4382 (
4326 - cd 13b &&
4383 + cd 13b_info &&
4384
4385 git reset --hard &&
4386 git checkout A^0 &&
@@ -4352,10 +4409,10 @@ test_expect_success '13b-check(info): messages for transitive rename with confli
4409 # d and B had full knowledge, but that's a slippery slope as
4410 # shown in testcase 13d.
4411
4355 -test_expect_success '13c-setup: messages for rename/rename(1to1) via transitive rename' '
4356 - test_create_repo 13c &&
4412 +test_setup_13c () {
4413 + test_create_repo 13c_$1 &&
4414 (
4358 - cd 13c &&
4415 + cd 13c_$1 &&
4416
4417 mkdir x &&
4418 mkdir z &&
@@ -4383,11 +4440,12 @@ test_expect_success '13c-setup: messages for rename/rename(1to1) via transitive
4440 test_tick &&
4441 git commit -m "B"
4442 )
4386 -'
4443 +}
4444
4388 -test_expect_success '13c-check(conflict): messages for rename/rename(1to1) via transitive rename' '
4445 +test_expect_success '13c(conflict): messages for rename/rename(1to1) via transitive rename' '
4446 + test_setup_13c conflict &&
4447 (
4390 - cd 13c &&
4448 + cd 13c_conflict &&
4449
4450 git checkout A^0 &&
4451
@@ -4404,9 +4462,10 @@ test_expect_success '13c-check(conflict): messages for rename/rename(1to1) via t
4462 )
4463 '
4464
4407 -test_expect_success '13c-check(info): messages for rename/rename(1to1) via transitive rename' '
4465 +test_expect_success '13c(info): messages for rename/rename(1to1) via transitive rename' '
4466 + test_setup_13c info &&
4467 (
4409 - cd 13c &&
4468 + cd 13c_info &&
4469
4470 git reset --hard &&
4471 git checkout A^0 &&
@@ -4438,10 +4497,10 @@ test_expect_success '13c-check(info): messages for rename/rename(1to1) via trans
4497 # * B renames a/y to c/y, and A renames c/->d/ => a/y -> d/y
4498 # No conflict in where a/y ends up, so put it in d/y.
4499
4441 -test_expect_success '13d-setup: messages for rename/rename(1to1) via dual transitive rename' '
4442 - test_create_repo 13d &&
4500 +test_setup_13d () {
4501 + test_create_repo 13d_$1 &&
4502 (
4444 - cd 13d &&
4503 + cd 13d_$1 &&
4504
4505 mkdir a &&
4506 mkdir b &&
@@ -4470,11 +4529,12 @@ test_expect_success '13d-setup: messages for rename/rename(1to1) via dual transi
4529 test_tick &&
4530 git commit -m "B"
4531 )
4473 -'
4532 +}
4533
4475 -test_expect_success '13d-check(conflict): messages for rename/rename(1to1) via dual transitive rename' '
4534 +test_expect_success '13d(conflict): messages for rename/rename(1to1) via dual transitive rename' '
4535 + test_setup_13d conflict &&
4536 (
4477 - cd 13d &&
4537 + cd 13d_conflict &&
4538
4539 git checkout A^0 &&
4540
@@ -4494,9 +4554,10 @@ test_expect_success '13d-check(conflict): messages for rename/rename(1to1) via d
4554 )
4555 '
4556
4497 -test_expect_success '13d-check(info): messages for rename/rename(1to1) via dual transitive rename' '
4557 +test_expect_success '13d(info): messages for rename/rename(1to1) via dual transitive rename' '
4558 + test_setup_13d info &&
4559 (
4499 - cd 13d &&
4560 + cd 13d_info &&
4561
4562 git reset --hard &&
4563 git checkout A^0 &&
@@ -4562,7 +4623,7 @@ test_expect_success '13d-check(info): messages for rename/rename(1to1) via dual
4623 # in the outer merge for this special kind of setup, but it at
4624 # least avoids hitting a BUG().
4625 #
4565 -test_expect_success '13e-setup: directory rename detection in recursive case' '
4626 +test_setup_13e () {
4627 test_create_repo 13e &&
4628 (
4629 cd 13e &&
@@ -4607,9 +4668,10 @@ test_expect_success '13e-setup: directory rename detection in recursive case' '
4668 test_tick &&
4669 git commit -m "D"
4670 )
4610 -'
4671 +}
4672
4612 -test_expect_success '13e-check: directory rename detection in recursive case' '
4673 +test_expect_success '13e: directory rename detection in recursive case' '
4674 + test_setup_13e &&
4675 (
4676 cd 13e &&
4677
t/t6046-merge-skip-unneeded-updates.sh
+62 -73
@@ -36,10 +36,10 @@ test_description="merge cases"
36 # Commit B: b_3
37 # Expected: b_2
38
39 -test_expect_success '1a-setup: Modify(A)/Modify(B), change on B subset of A' '
40 - test_create_repo 1a &&
39 +test_setup_1a () {
40 + test_create_repo 1a_$1 &&
41 (
42 - cd 1a &&
42 + cd 1a_$1 &&
43
44 test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
45 git add b &&
@@ -62,13 +62,12 @@ test_expect_success '1a-setup: Modify(A)/Modify(B), change on B subset of A' '
62 test_tick &&
63 git commit -m "B"
64 )
65 -'
65 +}
66
67 -test_expect_success '1a-check-L: Modify(A)/Modify(B), change on B subset of A' '
68 - test_when_finished "git -C 1a reset --hard" &&
69 - test_when_finished "git -C 1a clean -fd" &&
67 +test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' '
68 + test_setup_1a L &&
69 (
71 - cd 1a &&
70 + cd 1a_L &&
71
72 git checkout A^0 &&
73
@@ -96,11 +95,10 @@ test_expect_success '1a-check-L: Modify(A)/Modify(B), change on B subset of A' '
95 )
96 '
97
99 -test_expect_success '1a-check-R: Modify(A)/Modify(B), change on B subset of A' '
100 - test_when_finished "git -C 1a reset --hard" &&
101 - test_when_finished "git -C 1a clean -fd" &&
98 +test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' '
99 + test_setup_1a R &&
100 (
103 - cd 1a &&
101 + cd 1a_R &&
102
103 git checkout B^0 &&
104
@@ -133,10 +131,10 @@ test_expect_success '1a-check-R: Modify(A)/Modify(B), change on B subset of A' '
131 # Commit B: c_1
132 # Expected: c_2
133
136 -test_expect_success '2a-setup: Modify(A)/rename(B)' '
137 - test_create_repo 2a &&
134 +test_setup_2a () {
135 + test_create_repo 2a_$1 &&
136 (
139 - cd 2a &&
137 + cd 2a_$1 &&
138
139 test_seq 1 10 >b &&
140 git add b &&
@@ -158,13 +156,12 @@ test_expect_success '2a-setup: Modify(A)/rename(B)' '
156 test_tick &&
157 git commit -m "B"
158 )
161 -'
159 +}
160
163 -test_expect_success '2a-check-L: Modify/rename, merge into modify side' '
164 - test_when_finished "git -C 2a reset --hard" &&
165 - test_when_finished "git -C 2a clean -fd" &&
161 +test_expect_success '2a-L: Modify/rename, merge into modify side' '
162 + test_setup_2a L &&
163 (
167 - cd 2a &&
164 + cd 2a_L &&
165
166 git checkout A^0 &&
167
@@ -189,11 +186,10 @@ test_expect_success '2a-check-L: Modify/rename, merge into modify side' '
186 )
187 '
188
192 -test_expect_success '2a-check-R: Modify/rename, merge into rename side' '
193 - test_when_finished "git -C 2a reset --hard" &&
194 - test_when_finished "git -C 2a clean -fd" &&
189 +test_expect_success '2a-R: Modify/rename, merge into rename side' '
190 + test_setup_2a R &&
191 (
196 - cd 2a &&
192 + cd 2a_R &&
193
194 git checkout B^0 &&
195
@@ -224,10 +220,10 @@ test_expect_success '2a-check-R: Modify/rename, merge into rename side' '
220 # Commit B: b_3
221 # Expected: c_2
222
227 -test_expect_success '2b-setup: Rename+Mod(A)/Mod(B), B mods subset of A' '
228 - test_create_repo 2b &&
223 +test_setup_2b () {
224 + test_create_repo 2b_$1 &&
225 (
230 - cd 2b &&
226 + cd 2b_$1 &&
227
228 test_write_lines 1 2 3 4 5 6 7 8 9 10 >b &&
229 git add b &&
@@ -251,13 +247,12 @@ test_expect_success '2b-setup: Rename+Mod(A)/Mod(B), B mods subset of A' '
247 test_tick &&
248 git commit -m "B"
249 )
254 -'
250 +}
251
256 -test_expect_success '2b-check-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
257 - test_when_finished "git -C 2b reset --hard" &&
258 - test_when_finished "git -C 2b clean -fd" &&
252 +test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
253 + test_setup_2b L &&
254 (
260 - cd 2b &&
255 + cd 2b_L &&
256
257 git checkout A^0 &&
258
@@ -288,11 +283,10 @@ test_expect_success '2b-check-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
283 )
284 '
285
291 -test_expect_success '2b-check-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
292 - test_when_finished "git -C 2b reset --hard" &&
293 - test_when_finished "git -C 2b clean -fd" &&
286 +test_expect_success '2b-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
287 + test_setup_2b R &&
288 (
295 - cd 2b &&
289 + cd 2b_R &&
290
291 git checkout B^0 &&
292
@@ -332,7 +326,7 @@ test_expect_success '2b-check-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
326 # skip the update, then we're in trouble. This test verifies we do
327 # not make that particular mistake.
328
335 -test_expect_success '2c-setup: Modify b & add c VS rename b->c' '
329 +test_setup_2c () {
330 test_create_repo 2c &&
331 (
332 cd 2c &&
@@ -358,9 +352,10 @@ test_expect_success '2c-setup: Modify b & add c VS rename b->c' '
352 test_tick &&
353 git commit -m "B"
354 )
361 -'
355 +}
356
363 -test_expect_success '2c-check: Modify b & add c VS rename b->c' '
357 +test_expect_success '2c: Modify b & add c VS rename b->c' '
358 + test_setup_2c &&
359 (
360 cd 2c &&
361
@@ -428,10 +423,10 @@ test_expect_success '2c-check: Modify b & add c VS rename b->c' '
423 # Commit B: bq_1, bar/whatever
424 # Expected: bar/{bq_2, whatever}
425
431 -test_expect_success '3a-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
432 - test_create_repo 3a &&
426 +test_setup_3a () {
427 + test_create_repo 3a_$1 &&
428 (
434 - cd 3a &&
429 + cd 3a_$1 &&
430
431 mkdir foo &&
432 test_seq 1 10 >bq &&
@@ -456,13 +451,12 @@ test_expect_success '3a-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
451 test_tick &&
452 git commit -m "B"
453 )
459 -'
454 +}
455
461 -test_expect_success '3a-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
462 - test_when_finished "git -C 3a reset --hard" &&
463 - test_when_finished "git -C 3a clean -fd" &&
456 +test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
457 + test_setup_3a L &&
458 (
465 - cd 3a &&
459 + cd 3a_L &&
460
461 git checkout A^0 &&
462
@@ -487,11 +481,10 @@ test_expect_success '3a-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
481 )
482 '
483
490 -test_expect_success '3a-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
491 - test_when_finished "git -C 3a reset --hard" &&
492 - test_when_finished "git -C 3a clean -fd" &&
484 +test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
485 + test_setup_3a R &&
486 (
494 - cd 3a &&
487 + cd 3a_R &&
488
489 git checkout B^0 &&
490
@@ -522,10 +515,10 @@ test_expect_success '3a-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
515 # Commit B: bq_2, bar/whatever
516 # Expected: bar/{bq_2, whatever}
517
525 -test_expect_success '3b-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
526 - test_create_repo 3b &&
518 +test_setup_3b () {
519 + test_create_repo 3b_$1 &&
520 (
528 - cd 3b &&
521 + cd 3b_$1 &&
522
523 mkdir foo &&
524 test_seq 1 10 >bq &&
@@ -550,13 +543,12 @@ test_expect_success '3b-setup: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
543 test_tick &&
544 git commit -m "B"
545 )
553 -'
546 +}
547
555 -test_expect_success '3b-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
556 - test_when_finished "git -C 3b reset --hard" &&
557 - test_when_finished "git -C 3b clean -fd" &&
548 +test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
549 + test_setup_3b L &&
550 (
559 - cd 3b &&
551 + cd 3b_L &&
552
553 git checkout A^0 &&
554
@@ -581,11 +573,10 @@ test_expect_success '3b-check-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
573 )
574 '
575
584 -test_expect_success '3b-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
585 - test_when_finished "git -C 3b reset --hard" &&
586 - test_when_finished "git -C 3b clean -fd" &&
576 +test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
577 + test_setup_3b R &&
578 (
588 - cd 3b &&
579 + cd 3b_R &&
580
581 git checkout B^0 &&
582
@@ -621,7 +612,7 @@ test_expect_success '3b-check-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
612 # Working copy: b_4
613 # Expected: b_2 for merge, b_4 in working copy
614
624 -test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods present' '
615 +test_setup_4a () {
616 test_create_repo 4a &&
617 (
618 cd 4a &&
@@ -647,7 +638,7 @@ test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods
638 test_tick &&
639 git commit -m "B"
640 )
650 -'
641 +}
642
643 # NOTE: For as long as we continue using unpack_trees() without index_only
644 # set to true, it will error out on a case like this claiming the the locally
@@ -655,9 +646,8 @@ test_expect_success '4a-setup: Change on A, change on B subset of A, dirty mods
646 # correct requires doing the merge in-memory first, then realizing that no
647 # updates to the file are necessary, and thus that we can just leave the path
648 # alone.
658 -test_expect_failure '4a-check: Change on A, change on B subset of A, dirty mods present' '
659 - test_when_finished "git -C 4a reset --hard" &&
660 - test_when_finished "git -C 4a clean -fd" &&
649 +test_expect_failure '4a: Change on A, change on B subset of A, dirty mods present' '
650 + test_setup_4a &&
651 (
652 cd 4a &&
653
@@ -695,7 +685,7 @@ test_expect_failure '4a-check: Change on A, change on B subset of A, dirty mods
685 # Working copy: c_4
686 # Expected: c_2
687
698 -test_expect_success '4b-setup: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' '
688 +test_setup_4b () {
689 test_create_repo 4b &&
690 (
691 cd 4b &&
@@ -722,11 +712,10 @@ test_expect_success '4b-setup: Rename+Mod(A)/Mod(B), change on B subset of A, di
712 test_tick &&
713 git commit -m "B"
714 )
725 -'
715 +}
716
727 -test_expect_success '4b-check: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' '
728 - test_when_finished "git -C 4b reset --hard" &&
729 - test_when_finished "git -C 4b clean -fd" &&
717 +test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mods present' '
718 + test_setup_4b &&
719 (
720 cd 4b &&
721