75
76
git checkout A^0 &&
77
78
- git merge -s recursive B^0 &&
78
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
79
80
git ls-files -s >out &&
81
test_line_count = 4 out &&
142
143
git checkout A^0 &&
144
145
- git merge -s recursive B^0 &&
145
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
146
147
git ls-files -s >out &&
148
test_line_count = 4 out &&
201
202
git checkout A^0 &&
203
204
- git merge -s recursive B^0 &&
204
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
205
206
git ls-files -s >out &&
207
test_line_count = 3 out &&
270
271
git checkout A^0 &&
272
273
- test_must_fail git merge -s recursive B^0 >out &&
273
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
274
test_i18ngrep "CONFLICT (rename/rename)" out &&
275
276
git ls-files -s >out &&
350
351
git checkout A^0 &&
352
353
- git merge -s recursive B^0 &&
353
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
354
355
git ls-files -s >out &&
356
test_line_count = 3 out &&
416
417
git checkout A^0 &&
418
419
- git merge -s recursive B^0 &&
419
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
420
421
git ls-files -s >out &&
422
test_line_count = 6 out &&
497
498
git checkout A^0 &&
499
500
- test_must_fail git merge -s recursive B^0 >out &&
500
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
501
test_i18ngrep "CONFLICT.*directory rename split" out &&
502
503
git ls-files -s >out &&
559
560
git checkout A^0 &&
561
562
- git merge -s recursive B^0 >out &&
562
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
563
564
git ls-files -s >out &&
565
test_line_count = 3 out &&
640
641
git checkout A^0 &&
642
643
- git merge -s recursive B^0 &&
643
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
644
645
git ls-files -s >out &&
646
test_line_count = 3 out &&
705
706
git checkout A^0 &&
707
708
- test_must_fail git merge -s recursive B^0 >out &&
708
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
709
test_i18ngrep CONFLICT.*rename/rename.*z/d.*x/d.*w/d out &&
710
test_i18ngrep ! CONFLICT.*rename/rename.*y/d out &&
711
826
827
git checkout A^0 &&
828
829
- git merge -s recursive B^0 &&
829
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
830
831
git ls-files -s >out &&
832
test_line_count = 5 out &&
915
916
git checkout A^0 &&
917
918
- test_must_fail git merge -s recursive B^0 >out &&
918
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
919
test_i18ngrep "CONFLICT.*implicit dir rename" out &&
920
921
git ls-files -s >out &&
989
990
git checkout A^0 &&
991
992
- test_must_fail git merge -s recursive B^0 >out &&
992
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
993
test_i18ngrep "CONFLICT (add/add).* y/d" out &&
994
995
git ls-files -s >out &&
1069
1070
git checkout A^0 &&
1071
1072
- test_must_fail git merge -s recursive B^0 >out &&
1072
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1073
test_i18ngrep "CONFLICT (rename/rename).*x/d.*w/d.*z/d" out &&
1074
test_i18ngrep "CONFLICT (add/add).* y/d" out &&
1075
1153
1154
git checkout A^0 &&
1155
1156
- test_must_fail git merge -s recursive B^0 >out &&
1156
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1157
test_i18ngrep "CONFLICT (file/directory).*y/d" out &&
1158
1159
git ls-files -s >out &&
1243
1244
git checkout A^0 &&
1245
1246
- test_must_fail git merge -s recursive B^0 >out &&
1246
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1247
test_i18ngrep "CONFLICT (rename/delete).*z/c.*y/c" out &&
1248
1249
git ls-files -s >out &&
1308
1309
git checkout A^0 &&
1310
1311
- git merge -s recursive B^0 &&
1311
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
1312
1313
git ls-files -s >out &&
1314
test_line_count = 3 out &&
1370
1371
git checkout A^0 &&
1372
1373
- git merge -s recursive B^0 &&
1373
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
1374
1375
git ls-files -s >out &&
1376
test_line_count = 3 out &&
1432
1433
git checkout A^0 &&
1434
1435
- git merge -s recursive B^0 &&
1435
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
1436
1437
git ls-files -s >out &&
1438
test_line_count = 3 out &&
1495
1496
git checkout A^0 &&
1497
1498
- git merge -s recursive B^0 &&
1498
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
1499
1500
git ls-files -s >out &&
1501
test_line_count = 4 out &&
1591
1592
git checkout A^0 &&
1593
1594
- test_must_fail git merge -s recursive B^0 >out &&
1594
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1595
test_i18ngrep "CONFLICT (rename/rename).*z/b.*y/b.*w/b" out &&
1596
test_i18ngrep "CONFLICT (rename/rename).*z/c.*y/c.*x/c" out &&
1597
1663
1664
git checkout A^0 &&
1665
1666
- test_must_fail git merge -s recursive B^0 >out &&
1666
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1667
test_i18ngrep "CONFLICT (rename/rename)" out &&
1668
1669
git ls-files -s >out &&
1740
1741
git checkout A^0 &&
1742
1743
- test_must_fail git merge -s recursive B^0 >out &&
1743
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1744
test_i18ngrep "CONFLICT (rename/rename).*x/d.*w/d.*y/d" out &&
1745
1746
git ls-files -s >out &&
1804
1805
git checkout A^0 &&
1806
1807
- test_must_fail git merge -s recursive B^0 >out &&
1807
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1808
test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out &&
1809
1810
git ls-files -s >out &&
1894
1895
git checkout A^0 &&
1896
1897
- test_must_fail git merge -s recursive B^0 >out &&
1897
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
1898
test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out &&
1899
1900
git ls-files -s >out &&
1985
1986
git checkout A^0 &&
1987
1988
- git merge -s recursive B^0 &&
1988
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
1989
1990
git ls-files -s >out &&
1991
test_line_count = 6 out &&
2063
2064
git checkout A^0 &&
2065
2066
- git merge -s recursive B^0 &&
2066
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2067
2068
git ls-files -s >out &&
2069
test_line_count = 6 out &&
2135
2136
git checkout A^0 &&
2137
2138
- test_must_fail git merge -s recursive B^0 >out &&
2138
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
2139
test_i18ngrep "CONFLICT (modify/delete).* z/d" out &&
2140
2141
git ls-files -s >out &&
2212
2213
git checkout A^0 &&
2214
2215
- git merge -s recursive B^0 &&
2215
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2216
2217
git ls-files -s >out &&
2218
test_line_count = 3 out &&
2287
2288
git checkout A^0 &&
2289
2290
- test_must_fail git merge -s recursive B^0 >out 2>err &&
2290
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
2291
test_i18ngrep CONFLICT.*rename/rename.*z/c.*y/c.*w/c out &&
2292
test_i18ngrep CONFLICT.*rename/rename.*z/b.*y/b.*w/b out &&
2293
2374
2375
git checkout A^0 &&
2376
2377
- git merge -s recursive B^0 &&
2377
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2378
2379
git ls-files -s >out &&
2380
test_line_count = 7 out &&
2444
2445
git checkout A^0 &&
2446
2447
- git merge -s recursive B^0 &&
2447
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2448
2449
git ls-files -s >out &&
2450
test_line_count = 3 out &&
2534
2535
git checkout A^0 &&
2536
2537
- git merge -s recursive B^0 >out &&
2537
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
2538
test_i18ngrep "WARNING: Avoiding applying x -> z rename to x/f" out &&
2539
2540
git ls-files -s >out &&
2622
2623
git checkout A^0 &&
2624
2625
- git merge -s recursive B^0 >out &&
2625
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
2626
test_i18ngrep "WARNING: Avoiding applying z -> y rename to z/t" out &&
2627
test_i18ngrep "WARNING: Avoiding applying y -> x rename to y/a" out &&
2628
test_i18ngrep "WARNING: Avoiding applying x -> w rename to x/b" out &&
2704
2705
git checkout A^0 &&
2706
2707
- test_must_fail git merge -s recursive B^0 >out &&
2707
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
2708
grep "CONFLICT (implicit dir rename): Cannot map more than one path to combined/yo" out >error_line &&
2709
grep -q dir1/yo error_line &&
2710
grep -q dir2/yo error_line &&
2782
2783
git checkout A^0 &&
2784
2785
- git merge -s recursive B^0 &&
2785
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2786
2787
git ls-files -s >out &&
2788
test_line_count = 4 out &&
2849
2850
git checkout A^0 &&
2851
2852
- git merge -s recursive B^0 &&
2852
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2853
2854
git ls-files -s >out &&
2855
test_line_count = 4 out &&
2918
2919
git checkout A^0 &&
2920
2921
- git merge -s recursive B^0 &&
2921
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
2922
2923
git ls-files -s >out &&
2924
test_line_count = 3 out &&
2993
echo very >z/c &&
2994
echo important >z/d &&
2995
2996
- test_must_fail git merge -s recursive B^0 >out 2>err &&
2996
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
2997
test_i18ngrep "The following untracked working tree files would be overwritten by merge" err &&
2998
2999
git ls-files -s >out &&
3061
echo important >y/d &&
3062
echo contents >y/e &&
3063
3064
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3064
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3065
test_i18ngrep "CONFLICT (rename/delete).*Version B\^0 of y/d left in tree at y/d~B\^0" out &&
3066
test_i18ngrep "Error: Refusing to lose untracked file at y/e; writing to y/e~B\^0 instead" out &&
3067
3137
git checkout A^0 &&
3138
echo important >y/c &&
3139
3140
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3140
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3141
test_i18ngrep "CONFLICT (rename/rename)" out &&
3142
test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~B\^0 instead" out &&
3143
3174
mkdir y &&
3175
echo important >y/c &&
3176
3177
- test_must_fail git merge -s recursive A^0 >out 2>err &&
3177
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err &&
3178
test_i18ngrep "CONFLICT (rename/rename)" out &&
3179
test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~HEAD instead" out &&
3180
3249
git checkout A^0 &&
3250
echo important >y/wham &&
3251
3252
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3252
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3253
test_i18ngrep "CONFLICT (rename/rename)" out &&
3254
test_i18ngrep "Refusing to lose untracked file at y/wham" out &&
3255
3327
mkdir z &&
3328
echo random >z/c &&
3329
3330
- git merge -s recursive B^0 >out 2>err &&
3330
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3331
test_i18ngrep ! "following untracked working tree files would be overwritten by merge" err &&
3332
3333
git ls-files -s >out &&
3407
git checkout A^0 &&
3408
echo stuff >>z/c &&
3409
3410
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3410
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3411
test_i18ngrep "Refusing to lose dirty file at z/c" out &&
3412
3413
test_seq 1 10 >expected &&
3479
git checkout A^0 &&
3480
echo stuff >>z/c &&
3481
3482
- git merge -s recursive B^0 >out 2>err &&
3482
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3483
test_i18ngrep "Refusing to lose dirty file at z/c" out &&
3484
3485
grep -q stuff z/c &&
3554
git checkout A^0 &&
3555
echo stuff >>y/c &&
3556
3557
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3557
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3558
test_i18ngrep "following files would be overwritten by merge" err &&
3559
3560
grep -q stuff y/c &&
3621
git checkout A^0 &&
3622
echo stuff >>z/c &&
3623
3624
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3624
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3625
test_i18ngrep "Refusing to lose dirty file at z/c" out &&
3626
3627
grep -q stuff z/c &&
3700
git checkout A^0 &&
3701
echo mods >>y/c &&
3702
3703
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3703
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3704
test_i18ngrep "CONFLICT (rename/rename)" out &&
3705
test_i18ngrep "Refusing to lose dirty file at y/c" out &&
3706
3782
git checkout A^0 &&
3783
echo important >>y/wham &&
3784
3785
- test_must_fail git merge -s recursive B^0 >out 2>err &&
3785
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
3786
test_i18ngrep "CONFLICT (rename/rename)" out &&
3787
test_i18ngrep "Refusing to lose dirty file at y/wham" out &&
3788
3870
3871
git checkout A^0 &&
3872
3873
- git merge -s recursive B^0 &&
3873
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
3874
3875
git ls-files -s >out &&
3876
test_line_count = 6 out &&
3946
3947
git checkout A^0 &&
3948
3949
- git merge -s recursive B^0 &&
3949
+ git -c merge.directoryRenames=true merge -s recursive B^0 &&
3950
3951
git ls-files -s >out &&
3952
test_line_count = 4 out &&
4016
4017
git checkout A^0 &&
4018
4019
- test_must_fail git merge -s recursive B^0 &&
4019
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 &&
4020
4021
git ls-files -u >out &&
4022
test_line_count = 12 out &&
4051
)
4052
'
4053
4054
+###########################################################################
4055
+# SECTION 13: Checking informational and conflict messages
4056
+#
4057
+# A year after directory rename detection became the default, it was
4058
+# instead decided to report conflicts on the pathname on the basis that
4059
+# some users may expect the new files added or moved into a directory to
4060
+# be unrelated to all the other files in that directory, and thus that
4061
+# directory rename detection is unexpected. Test that the messages printed
4062
+# match our expectation.
4063
+###########################################################################
4064
+
4065
+# Testcase 13a, Basic directory rename with newly added files
4066
+# Commit O: z/{b,c}
4067
+# Commit A: y/{b,c}
4068
+# Commit B: z/{b,c,d,e/f}
4069
+# Expected: y/{b,c,d,e/f}, with notices/conflicts for both y/d and y/e/f
4070
+
4071
+test_expect_success '13a-setup: messages for newly added files' '
4072
+ test_create_repo 13a &&
4073
+ (
4074
+ cd 13a &&
4075
+
4076
+ mkdir z &&
4077
+ echo b >z/b &&
4078
+ echo c >z/c &&
4079
+ git add z &&
4080
+ test_tick &&
4081
+ git commit -m "O" &&
4082
+
4083
+ git branch O &&
4084
+ git branch A &&
4085
+ git branch B &&
4086
+
4087
+ git checkout A &&
4088
+ git mv z y &&
4089
+ test_tick &&
4090
+ git commit -m "A" &&
4091
+
4092
+ git checkout B &&
4093
+ echo d >z/d &&
4094
+ mkdir z/e &&
4095
+ echo f >z/e/f &&
4096
+ git add z/d z/e/f &&
4097
+ test_tick &&
4098
+ git commit -m "B"
4099
+ )
4100
+'
4101
+
4102
+test_expect_success '13a-check(conflict): messages for newly added files' '
4103
+ (
4104
+ cd 13a &&
4105
+
4106
+ git checkout A^0 &&
4107
+
4108
+ test_must_fail git merge -s recursive B^0 >out 2>err &&
4109
+
4110
+ test_i18ngrep CONFLICT..file.location.*z/e/f.added.in.B^0.*y/e/f out &&
4111
+ test_i18ngrep CONFLICT..file.location.*z/d.added.in.B^0.*y/d out &&
4112
+
4113
+ git ls-files >paths &&
4114
+ ! grep z/ paths &&
4115
+ grep "y/[de]" paths &&
4116
+
4117
+ test_path_is_missing z/d &&
4118
+ test_path_is_file y/d &&
4119
+ test_path_is_missing z/e/f &&
4120
+ test_path_is_file y/e/f
4121
+ )
4122
+'
4123
+
4124
+test_expect_success '13a-check(info): messages for newly added files' '
4125
+ (
4126
+ cd 13a &&
4127
+
4128
+ git reset --hard &&
4129
+ git checkout A^0 &&
4130
+
4131
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
4132
+
4133
+ test_i18ngrep Path.updated:.*z/e/f.added.in.B^0.*y/e/f out &&
4134
+ test_i18ngrep Path.updated:.*z/d.added.in.B^0.*y/d out &&
4135
+
4136
+ git ls-files >paths &&
4137
+ ! grep z/ paths &&
4138
+ grep "y/[de]" paths &&
4139
+
4140
+ test_path_is_missing z/d &&
4141
+ test_path_is_file y/d &&
4142
+ test_path_is_missing z/e/f &&
4143
+ test_path_is_file y/e/f
4144
+ )
4145
+'
4146
+
4147
+# Testcase 13b, Transitive rename with conflicted content merge and default
4148
+# "conflict" setting
4149
+# (Related to testcase 1c, 9b)
4150
+# Commit O: z/{b,c}, x/d_1
4151
+# Commit A: y/{b,c}, x/d_2
4152
+# Commit B: z/{b,c,d_3}
4153
+# Expected: y/{b,c,d_merged}, with two conflict messages for y/d,
4154
+# one about content, and one about file location
4155
+
4156
+test_expect_success '13b-setup: messages for transitive rename with conflicted content' '
4157
+ test_create_repo 13b &&
4158
+ (
4159
+ cd 13b &&
4160
+
4161
+ mkdir x &&
4162
+ mkdir z &&
4163
+ test_seq 1 10 >x/d &&
4164
+ echo b >z/b &&
4165
+ echo c >z/c &&
4166
+ git add x z &&
4167
+ test_tick &&
4168
+ git commit -m "O" &&
4169
+
4170
+ git branch O &&
4171
+ git branch A &&
4172
+ git branch B &&
4173
+
4174
+ git checkout A &&
4175
+ git mv z y &&
4176
+ echo 11 >>x/d &&
4177
+ git add x/d &&
4178
+ test_tick &&
4179
+ git commit -m "A" &&
4180
+
4181
+ git checkout B &&
4182
+ echo eleven >>x/d &&
4183
+ git mv x/d z/d &&
4184
+ git add z/d &&
4185
+ test_tick &&
4186
+ git commit -m "B"
4187
+ )
4188
+'
4189
+
4190
+test_expect_success '13b-check(conflict): messages for transitive rename with conflicted content' '
4191
+ (
4192
+ cd 13b &&
4193
+
4194
+ git checkout A^0 &&
4195
+
4196
+ test_must_fail git merge -s recursive B^0 >out 2>err &&
4197
+
4198
+ test_i18ngrep CONFLICT.*content.*Merge.conflict.in.y/d out &&
4199
+ test_i18ngrep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
4200
+
4201
+ git ls-files >paths &&
4202
+ ! grep z/ paths &&
4203
+ grep "y/d" paths &&
4204
+
4205
+ test_path_is_missing z/d &&
4206
+ test_path_is_file y/d
4207
+ )
4208
+'
4209
+
4210
+test_expect_success '13b-check(info): messages for transitive rename with conflicted content' '
4211
+ (
4212
+ cd 13b &&
4213
+
4214
+ git reset --hard &&
4215
+ git checkout A^0 &&
4216
+
4217
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
4218
+
4219
+ test_i18ngrep CONFLICT.*content.*Merge.conflict.in.y/d out &&
4220
+ test_i18ngrep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
4221
+
4222
+ git ls-files >paths &&
4223
+ ! grep z/ paths &&
4224
+ grep "y/d" paths &&
4225
+
4226
+ test_path_is_missing z/d &&
4227
+ test_path_is_file y/d
4228
+ )
4229
+'
4230
+
4231
+# Testcase 13c, Rename/rename(1to1) due to directory rename
4232
+# Commit O: z/{b,c}, x/{d,e}
4233
+# Commit A: y/{b,c,d}, x/e
4234
+# Commit B: z/{b,c,d}, x/e
4235
+# Expected: y/{b,c,d}, with info or conflict messages for d (
4236
+# A: renamed x/d -> z/d; B: renamed z/ -> y/ AND renamed x/d to y/d
4237
+# One could argue A had partial knowledge of what was done with
4238
+# d and B had full knowledge, but that's a slippery slope as
4239
+# shown in testcase 13d.
4240
+
4241
+test_expect_success '13c-setup: messages for rename/rename(1to1) via transitive rename' '
4242
+ test_create_repo 13c &&
4243
+ (
4244
+ cd 13c &&
4245
+
4246
+ mkdir x &&
4247
+ mkdir z &&
4248
+ test_seq 1 10 >x/d &&
4249
+ echo e >x/e &&
4250
+ echo b >z/b &&
4251
+ echo c >z/c &&
4252
+ git add x z &&
4253
+ test_tick &&
4254
+ git commit -m "O" &&
4255
+
4256
+ git branch O &&
4257
+ git branch A &&
4258
+ git branch B &&
4259
+
4260
+ git checkout A &&
4261
+ git mv z y &&
4262
+ git mv x/d y/ &&
4263
+ test_tick &&
4264
+ git commit -m "A" &&
4265
+
4266
+ git checkout B &&
4267
+ git mv x/d z/d &&
4268
+ git add z/d &&
4269
+ test_tick &&
4270
+ git commit -m "B"
4271
+ )
4272
+'
4273
+
4274
+test_expect_success '13c-check(conflict): messages for rename/rename(1to1) via transitive rename' '
4275
+ (
4276
+ cd 13c &&
4277
+
4278
+ git checkout A^0 &&
4279
+
4280
+ test_must_fail git merge -s recursive B^0 >out 2>err &&
4281
+
4282
+ test_i18ngrep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
4283
+
4284
+ git ls-files >paths &&
4285
+ ! grep z/ paths &&
4286
+ grep "y/d" paths &&
4287
+
4288
+ test_path_is_missing z/d &&
4289
+ test_path_is_file y/d
4290
+ )
4291
+'
4292
+
4293
+test_expect_success '13c-check(info): messages for rename/rename(1to1) via transitive rename' '
4294
+ (
4295
+ cd 13c &&
4296
+
4297
+ git reset --hard &&
4298
+ git checkout A^0 &&
4299
+
4300
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
4301
+
4302
+ test_i18ngrep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
4303
+
4304
+ git ls-files >paths &&
4305
+ ! grep z/ paths &&
4306
+ grep "y/d" paths &&
4307
+
4308
+ test_path_is_missing z/d &&
4309
+ test_path_is_file y/d
4310
+ )
4311
+'
4312
+
4313
+# Testcase 13d, Rename/rename(1to1) due to directory rename on both sides
4314
+# Commit O: a/{z,y}, b/x, c/w
4315
+# Commit A: a/z, b/{y,x}, d/w
4316
+# Commit B: a/z, d/x, c/{y,w}
4317
+# Expected: a/z, d/{y,x,w} with no file location conflict for x
4318
+# Easy cases:
4319
+# * z is always in a; so it stays in a.
4320
+# * x starts in b, only modified on one side to move into d/
4321
+# * w starts in c, only modified on one side to move into d/
4322
+# Hard case:
4323
+# * A renames a/y to b/y, and B renames b/->d/ => a/y -> d/y
4324
+# * B renames a/y to c/y, and A renames c/->d/ => a/y -> d/y
4325
+# No conflict in where a/y ends up, so put it in d/y.
4326
+
4327
+test_expect_success '13d-setup: messages for rename/rename(1to1) via dual transitive rename' '
4328
+ test_create_repo 13d &&
4329
+ (
4330
+ cd 13d &&
4331
+
4332
+ mkdir a &&
4333
+ mkdir b &&
4334
+ mkdir c &&
4335
+ echo z >a/z &&
4336
+ echo y >a/y &&
4337
+ echo x >b/x &&
4338
+ echo w >c/w &&
4339
+ git add a b c &&
4340
+ test_tick &&
4341
+ git commit -m "O" &&
4342
+
4343
+ git branch O &&
4344
+ git branch A &&
4345
+ git branch B &&
4346
+
4347
+ git checkout A &&
4348
+ git mv a/y b/ &&
4349
+ git mv c/ d/ &&
4350
+ test_tick &&
4351
+ git commit -m "A" &&
4352
+
4353
+ git checkout B &&
4354
+ git mv a/y c/ &&
4355
+ git mv b/ d/ &&
4356
+ test_tick &&
4357
+ git commit -m "B"
4358
+ )
4359
+'
4360
+
4361
+test_expect_success '13d-check(conflict): messages for rename/rename(1to1) via dual transitive rename' '
4362
+ (
4363
+ cd 13d &&
4364
+
4365
+ git checkout A^0 &&
4366
+
4367
+ test_must_fail git merge -s recursive B^0 >out 2>err &&
4368
+
4369
+ test_i18ngrep CONFLICT..file.location.*a/y.renamed.to.b/y.*moved.to.d/y out &&
4370
+ test_i18ngrep CONFLICT..file.location.*a/y.renamed.to.c/y.*moved.to.d/y out &&
4371
+
4372
+ git ls-files >paths &&
4373
+ ! grep b/ paths &&
4374
+ ! grep c/ paths &&
4375
+ grep "d/y" paths &&
4376
+
4377
+ test_path_is_missing b/y &&
4378
+ test_path_is_missing c/y &&
4379
+ test_path_is_file d/y
4380
+ )
4381
+'
4382
+
4383
+test_expect_success '13d-check(info): messages for rename/rename(1to1) via dual transitive rename' '
4384
+ (
4385
+ cd 13d &&
4386
+
4387
+ git reset --hard &&
4388
+ git checkout A^0 &&
4389
+
4390
+ git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
4391
+
4392
+ test_i18ngrep Path.updated.*a/y.renamed.to.b/y.*moving.it.to.d/y out &&
4393
+ test_i18ngrep Path.updated.*a/y.renamed.to.c/y.*moving.it.to.d/y out &&
4394
+
4395
+ git ls-files >paths &&
4396
+ ! grep b/ paths &&
4397
+ ! grep c/ paths &&
4398
+ grep "d/y" paths &&
4399
+
4400
+ test_path_is_missing b/y &&
4401
+ test_path_is_missing c/y &&
4402
+ test_path_is_file d/y
4403
+ )
4404
+'
4405
+
4406
test_done