]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7610: add mergetool --gui tests
authorDenton Liu <liu.denton@gmail.com>
Wed, 24 Apr 2019 22:46:59 +0000 (15:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 02:31:49 +0000 (11:31 +0900)
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>
t/t7610-mergetool.sh

index 69711487dd492f9f849787a126fcb10f6ba86144..dad607e1864b472a2e2ed9bb3821b33ddc795d93 100755 (executable)
@@ -145,6 +145,28 @@ test_expect_success 'custom mergetool' '
        git commit -m "branch1 resolved with mergetool"
 '
 
+test_expect_success 'gui mergetool' '
+       test_config merge.guitool myguitool &&
+       test_config mergetool.myguitool.cmd "(printf \"gui \" && cat \"\$REMOTE\") >\"\$MERGED\"" &&
+       test_config mergetool.myguitool.trustExitCode true &&
+       test_when_finished "git reset --hard" &&
+       git checkout -b test$test_count branch1 &&
+       git submodule update -N &&
+       test_must_fail git merge master &&
+       ( yes "" | git mergetool --gui both ) &&
+       ( yes "" | git mergetool -g file1 file1 ) &&
+       ( yes "" | git mergetool --gui file2 "spaced name" ) &&
+       ( yes "" | git mergetool --gui subdir/file3 ) &&
+       ( yes "d" | git mergetool --gui file11 ) &&
+       ( yes "d" | git mergetool --gui file12 ) &&
+       ( yes "l" | git mergetool --gui submod ) &&
+       test "$(cat file1)" = "gui master updated" &&
+       test "$(cat file2)" = "gui master new" &&
+       test "$(cat subdir/file3)" = "gui master new sub" &&
+       test "$(cat submod/bar)" = "branch1 submodule" &&
+       git commit -m "branch1 resolved with mergetool"
+'
+
 test_expect_success 'mergetool crlf' '
        test_when_finished "git reset --hard" &&
        # This test_config line must go after the above reset line so that