Skip to content

Commit 99474b6

Browse files
davvidgitster
authored andcommitted
difftool: honor --trust-exit-code for builtin tools
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 <[email protected]> Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2b52123 commit 99474b6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

git-mergetool--lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ run_merge_tool () {
221221
else
222222
run_diff_cmd "$1"
223223
fi
224+
status=$?
224225
return $status
225226
}
226227

t/t7800-difftool.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ test_expect_success PERL 'difftool forwards exit code with --trust-exit-code' '
8686
test_must_fail git difftool -y --trust-exit-code -t error branch
8787
'
8888

89+
test_expect_success PERL 'difftool forwards exit code with --trust-exit-code for built-ins' '
90+
test_config difftool.vimdiff.path false &&
91+
test_must_fail git difftool -y --trust-exit-code -t vimdiff branch
92+
'
93+
8994
test_expect_success PERL 'difftool honors difftool.trustExitCode = true' '
9095
test_config difftool.error.cmd false &&
9196
test_config difftool.trustExitCode true &&

0 commit comments

Comments
 (0)