diff options
-rwxr-xr-x | git-difftool--helper.sh | 7 | ||||
-rwxr-xr-x | t/t7800-difftool.sh | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh index 84d6cc021c..7bfb6737df 100755 --- a/git-difftool--helper.sh +++ b/git-difftool--helper.sh @@ -86,6 +86,13 @@ else do launch_merge_tool "$1" "$2" "$5" status=$? + if test $status -ge 126 + then + # Command not found (127), not executable (126) or + # exited via a signal (>= 128). + exit $status + fi + if test "$status" != 0 && test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true then diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 2974900578..70a2de461a 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -124,6 +124,12 @@ test_expect_success PERL 'difftool stops on error with --trust-exit-code' ' test_cmp expect actual ' +test_expect_success PERL 'difftool honors exit status if command not found' ' + test_config difftool.nonexistent.cmd i-dont-exist && + test_config difftool.trustExitCode false && + test_must_fail git difftool -y -t nonexistent branch +' + test_expect_success PERL 'difftool honors --gui' ' difftool_test_setup && test_config merge.tool bogus-tool && |