@@ -16,23 +16,33 @@ Testing basic merge tool invocation'
16
16
test_expect_success ' setup' '
17
17
git config rerere.enabled true &&
18
18
echo master >file1 &&
19
+ echo master file11 >file11 &&
20
+ echo master file12 >file12 &&
21
+ echo master file13 >file13 &&
22
+ echo master file14 >file14 &&
19
23
mkdir subdir &&
20
24
echo master sub >subdir/file3 &&
21
- git add file1 subdir/file3 &&
22
- git commit -m "added file1 " &&
25
+ git add file1 file1[1-4] subdir/file3 &&
26
+ git commit -m "add initial versions " &&
23
27
24
28
git checkout -b branch1 master &&
25
29
echo branch1 change >file1 &&
26
30
echo branch1 newfile >file2 &&
31
+ echo branch1 change file11 >file11 &&
32
+ echo branch1 change file13 >file13 &&
27
33
echo branch1 sub >subdir/file3 &&
28
- git add file1 file2 subdir/file3 &&
34
+ git add file1 file11 file13 file2 subdir/file3 &&
35
+ git rm file12 &&
29
36
git commit -m "branch1 changes" &&
30
37
31
38
git checkout master &&
32
39
echo master updated >file1 &&
33
40
echo master new >file2 &&
41
+ echo master updated file12 >file12 &&
42
+ echo master updated file14 >file14 &&
34
43
echo master new sub >subdir/file3 &&
35
- git add file1 file2 subdir/file3 &&
44
+ git add file1 file12 file14 file2 subdir/file3 &&
45
+ git rm file11 &&
36
46
git commit -m "master updates" &&
37
47
38
48
git config merge.tool mytool &&
@@ -46,6 +56,8 @@ test_expect_success 'custom mergetool' '
46
56
( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
47
57
( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
48
58
( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
59
+ ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
60
+ ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
49
61
test "$(cat file1)" = "master updated" &&
50
62
test "$(cat file2)" = "master new" &&
51
63
test "$(cat subdir/file3)" = "master new sub" &&
@@ -59,6 +71,8 @@ test_expect_success 'mergetool crlf' '
59
71
( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
60
72
( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
61
73
( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
74
+ ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
75
+ ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
62
76
test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" &&
63
77
test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
64
78
test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
@@ -82,6 +96,8 @@ test_expect_success 'mergetool on file in parent dir' '
82
96
cd subdir &&
83
97
( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) &&
84
98
( yes "" | git mergetool ../file2 >/dev/null 2>&1 ) &&
99
+ ( yes "d" | git mergetool ../file11 >/dev/null 2>&1 ) &&
100
+ ( yes "d" | git mergetool ../file12 >/dev/null 2>&1 ) &&
85
101
test "$(cat ../file1)" = "master updated" &&
86
102
test "$(cat ../file2)" = "master new" &&
87
103
git commit -m "branch1 resolved with mergetool - subdir"
@@ -92,6 +108,8 @@ test_expect_success 'mergetool skips autoresolved' '
92
108
git checkout -b test4 branch1 &&
93
109
test_must_fail git merge master &&
94
110
test -n "$(git ls-files -u)" &&
111
+ ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
112
+ ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
95
113
output="$(git mergetool --no-prompt)" &&
96
114
test "$output" = "No files need merging" &&
97
115
git reset --hard
@@ -102,13 +120,23 @@ test_expect_success 'mergetool merges all from subdir' '
102
120
cd subdir &&
103
121
git config rerere.enabled false &&
104
122
test_must_fail git merge master &&
105
- git mergetool --no-prompt &&
123
+ ( yes "d" "d" | git mergetool --no-prompt ) &&
106
124
test "$(cat ../file1)" = "master updated" &&
107
125
test "$(cat ../file2)" = "master new" &&
108
126
test "$(cat file3)" = "master new sub" &&
109
- git add ../file1 ../file2 file3 &&
110
127
git commit -m "branch2 resolved by mergetool from subdir"
111
128
)
112
129
'
113
130
131
+ test_expect_success ' mergetool skips resolved paths when rerere is active' '
132
+ git config rerere.enabled true &&
133
+ rm -rf .git/rr-cache &&
134
+ git checkout -b test5 branch1
135
+ test_must_fail git merge master >/dev/null 2>&1 &&
136
+ ( yes "d" "d" | git mergetool --no-prompt >/dev/null 2>&1 ) &&
137
+ output="$(yes "n" | git mergetool --no-prompt)" &&
138
+ test "$output" = "No files need merging" &&
139
+ git reset --hard
140
+ '
141
+
114
142
test_done
0 commit comments