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
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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 &&
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 &&
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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
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 &&
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 &&
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
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 &&
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 &&
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
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 &&
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 &&
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
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 &&
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 &&
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