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 <j6t@kdbg.org>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Aguilar
2014-10-26 18:15:42 -07:00
committed by Junio C Hamano
parent 25098690a0
commit 2b52123fcf
4 changed files with 75 additions and 0 deletions

View File

@@ -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