@@ -39,6 +39,7 @@ test_expect_success 'setup' '
39
39
echo branch1 change >file1 &&
40
40
echo branch1 newfile >file2 &&
41
41
echo branch1 spaced >"spaced name" &&
42
+ echo branch1 both added >both &&
42
43
echo branch1 change file11 >file11 &&
43
44
echo branch1 change file13 >file13 &&
44
45
echo branch1 sub >subdir/file3 &&
@@ -50,6 +51,7 @@ test_expect_success 'setup' '
50
51
git checkout -b submod-branch1
51
52
) &&
52
53
git add file1 "spaced name" file11 file13 file2 subdir/file3 submod &&
54
+ git add both &&
53
55
git rm file12 &&
54
56
git commit -m "branch1 changes" &&
55
57
@@ -58,6 +60,7 @@ test_expect_success 'setup' '
58
60
echo master updated >file1 &&
59
61
echo master new >file2 &&
60
62
echo master updated spaced >"spaced name" &&
63
+ echo master both added >both &&
61
64
echo master updated file12 >file12 &&
62
65
echo master updated file14 >file14 &&
63
66
echo master new sub >subdir/file3 &&
@@ -69,18 +72,22 @@ test_expect_success 'setup' '
69
72
git checkout -b submod-master
70
73
) &&
71
74
git add file1 "spaced name" file12 file14 file2 subdir/file3 submod &&
75
+ git add both &&
72
76
git rm file11 &&
73
77
git commit -m "master updates" &&
74
78
75
79
git config merge.tool mytool &&
76
80
git config mergetool.mytool.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
77
- git config mergetool.mytool.trustExitCode true
81
+ git config mergetool.mytool.trustExitCode true &&
82
+ git config mergetool.mybase.cmd "cat \"\$BASE\" >\"\$MERGED\"" &&
83
+ git config mergetool.mybase.trustExitCode true
78
84
'
79
85
80
86
test_expect_success ' custom mergetool' '
81
87
git checkout -b test1 branch1 &&
82
88
git submodule update -N &&
83
89
test_must_fail git merge master >/dev/null 2>&1 &&
90
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
84
91
( yes "" | git mergetool file1 file1 ) &&
85
92
( yes "" | git mergetool file2 "spaced name" >/dev/null 2>&1 ) &&
86
93
( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
@@ -101,6 +108,7 @@ test_expect_success 'mergetool crlf' '
101
108
( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
102
109
( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
103
110
( yes "" | git mergetool "spaced name" >/dev/null 2>&1 ) &&
111
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
104
112
( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
105
113
( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
106
114
( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
@@ -131,6 +139,7 @@ test_expect_success 'mergetool on file in parent dir' '
131
139
cd subdir &&
132
140
( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) &&
133
141
( yes "" | git mergetool ../file2 ../spaced\ name >/dev/null 2>&1 ) &&
142
+ ( yes "" | git mergetool ../both >/dev/null 2>&1 ) &&
134
143
( yes "d" | git mergetool ../file11 >/dev/null 2>&1 ) &&
135
144
( yes "d" | git mergetool ../file12 >/dev/null 2>&1 ) &&
136
145
( yes "l" | git mergetool ../submod >/dev/null 2>&1 ) &&
@@ -212,6 +221,7 @@ test_expect_success 'deleted vs modified submodule' '
212
221
test_must_fail git merge master &&
213
222
test -n "$(git ls-files -u)" &&
214
223
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
224
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
215
225
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
216
226
( yes "r" | git mergetool submod ) &&
217
227
rmdir submod && mv submod-movedaside submod &&
@@ -228,6 +238,7 @@ test_expect_success 'deleted vs modified submodule' '
228
238
test_must_fail git merge master &&
229
239
test -n "$(git ls-files -u)" &&
230
240
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
241
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
231
242
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
232
243
( yes "l" | git mergetool submod ) &&
233
244
test ! -e submod &&
@@ -241,6 +252,7 @@ test_expect_success 'deleted vs modified submodule' '
241
252
test_must_fail git merge test6 &&
242
253
test -n "$(git ls-files -u)" &&
243
254
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
255
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
244
256
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
245
257
( yes "r" | git mergetool submod ) &&
246
258
test ! -e submod &&
@@ -256,6 +268,7 @@ test_expect_success 'deleted vs modified submodule' '
256
268
test_must_fail git merge test6 &&
257
269
test -n "$(git ls-files -u)" &&
258
270
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
271
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
259
272
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
260
273
( yes "l" | git mergetool submod ) &&
261
274
test "$(cat submod/bar)" = "master submodule" &&
@@ -279,6 +292,7 @@ test_expect_success 'file vs modified submodule' '
279
292
test_must_fail git merge master &&
280
293
test -n "$(git ls-files -u)" &&
281
294
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
295
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
282
296
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
283
297
( yes "r" | git mergetool submod ) &&
284
298
rmdir submod && mv submod-movedaside submod &&
@@ -294,6 +308,7 @@ test_expect_success 'file vs modified submodule' '
294
308
test_must_fail git merge master &&
295
309
test -n "$(git ls-files -u)" &&
296
310
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
311
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
297
312
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
298
313
( yes "l" | git mergetool submod ) &&
299
314
git submodule update -N &&
@@ -309,6 +324,7 @@ test_expect_success 'file vs modified submodule' '
309
324
test_must_fail git merge test7 &&
310
325
test -n "$(git ls-files -u)" &&
311
326
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
327
+ ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
312
328
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
313
329
( yes "r" | git mergetool submod ) &&
314
330
test -d submod.orig &&
@@ -324,6 +340,7 @@ test_expect_success 'file vs modified submodule' '
324
340
test_must_fail git merge test7 &&
325
341
test -n "$(git ls-files -u)" &&
326
342
( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) &&
343
+ ( yes "" | git mergetool both>/dev/null 2>&1 ) &&
327
344
( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) &&
328
345
( yes "l" | git mergetool submod ) &&
329
346
test "$(cat submod/bar)" = "master submodule" &&
@@ -445,4 +462,13 @@ test_expect_success 'directory vs modified submodule' '
445
462
git submodule update -N
446
463
'
447
464
465
+ test_expect_success ' file with no base' '
466
+ git checkout -b test13 branch1 &&
467
+ test_must_fail git merge master &&
468
+ git mergetool --no-prompt --tool mybase -- both &&
469
+ >expected &&
470
+ test_cmp both expected &&
471
+ git reset --hard master >/dev/null 2>&1
472
+ '
473
+
448
474
test_done
0 commit comments