difftool: honor --trust-exit-code for builtin tools
authorDavid Aguilar <davvid@gmail.com>
Fri, 14 Nov 2014 21:33:55 +0000 (13:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Nov 2014 21:40:38 +0000 (13:40 -0800)
run_merge_tool() was not setting $status, which prevented the
exit code for builtin tools from being forwarded to the caller.

Capture the exit status and add a test to guarantee the behavior.

Reported-by: Adria Farres <14farresa@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-mergetool--lib.sh
t/t7800-difftool.sh
index c45a020301c16614057912b9a26d1466a94654a9..cce4f8c4945732daa0e1ca28cefb0ff4ed2fbbfc 100644 (file)
@@ -221,6 +221,7 @@ run_merge_tool () {
        else
                run_diff_cmd "$1"
        fi
+       status=$?
        return $status
 }
 
index 69bde7aa288d1deebb7d6204e29f88978d880998..ea35a0241c201ac12c29603a21421199dd097600 100755 (executable)
@@ -86,6 +86,11 @@ test_expect_success PERL 'difftool forwards exit code with --trust-exit-code' '
        test_must_fail git difftool -y --trust-exit-code -t error branch
 '
 
+test_expect_success PERL 'difftool forwards exit code with --trust-exit-code for built-ins' '
+       test_config difftool.vimdiff.path false &&
+       test_must_fail git difftool -y --trust-exit-code -t vimdiff branch
+'
+
 test_expect_success PERL 'difftool honors difftool.trustExitCode = true' '
        test_config difftool.error.cmd false &&
        test_config difftool.trustExitCode true &&