t7610: add mergetool --gui tests

In 063f2bdbf7 (mergetool: accept -g/--[no-]gui as arguments, 2018-10-24), mergetool was taught the --gui option but no tests were added to ensure that it was working properly. Add a test to ensure that it works. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Apr 24, 2019 at 15:46 UTC 57d93c1d2ce7deddf485e7c826278fef6815ec6b
1 file changed +22
t/t7610-mergetool.sh
+22
@@ -145,6 +145,28 @@ test_expect_success 'custom mergetool' '
145 git commit -m "branch1 resolved with mergetool"
146 '
147
148 +test_expect_success 'gui mergetool' '
149 + test_config merge.guitool myguitool &&
150 + test_config mergetool.myguitool.cmd "(printf \"gui \" && cat \"\$REMOTE\") >\"\$MERGED\"" &&
151 + test_config mergetool.myguitool.trustExitCode true &&
152 + test_when_finished "git reset --hard" &&
153 + git checkout -b test$test_count branch1 &&
154 + git submodule update -N &&
155 + test_must_fail git merge master &&
156 + ( yes "" | git mergetool --gui both ) &&
157 + ( yes "" | git mergetool -g file1 file1 ) &&
158 + ( yes "" | git mergetool --gui file2 "spaced name" ) &&
159 + ( yes "" | git mergetool --gui subdir/file3 ) &&
160 + ( yes "d" | git mergetool --gui file11 ) &&
161 + ( yes "d" | git mergetool --gui file12 ) &&
162 + ( yes "l" | git mergetool --gui submod ) &&
163 + test "$(cat file1)" = "gui master updated" &&
164 + test "$(cat file2)" = "gui master new" &&
165 + test "$(cat subdir/file3)" = "gui master new sub" &&
166 + test "$(cat submod/bar)" = "branch1 submodule" &&
167 + git commit -m "branch1 resolved with mergetool"
168 +'
169 +
170 test_expect_success 'mergetool crlf' '
171 test_when_finished "git reset --hard" &&
172 # This test_config line must go after the above reset line so that