From 2b52123fcf840686b69e10807fd0f985ec4167f3 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 26 Oct 2014 18:15:42 -0700 Subject: difftool: add support for --trust-exit-code Teach difftool to exit when a diff tool returns a non-zero exit code when either --trust-exit-code is specified or difftool.trustExitCode is true. Forward exit codes from invoked diff tools to the caller when --trust-exit-code is used. Suggested-by: Adri Farr <14farresa@gmail.com> Helped-by: Johannes Sixt Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- git-difftool--helper.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'git-difftool--helper.sh') diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh index aca0413c28..d4fb6dfe13 100755 --- a/git-difftool--helper.sh +++ b/git-difftool--helper.sh @@ -85,6 +85,12 @@ else while test $# -gt 6 do launch_merge_tool "$1" "$2" "$5" + status=$? + if test "$status" != 0 && + test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true + then + exit $status + fi shift 7 done fi -- cgit v1.2.3