summaryrefslogtreecommitdiff
path: root/git-mergetool--lib.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-10-01 12:58:57 -0700
committerJunio C Hamano <gitster@pobox.com>2012-10-01 12:58:57 -0700
commit5ec11ab39d11aecd731044955a7a4f7e925cdba6 (patch)
tree87432ee7fd9345d922f2fa7d182246125cc3b61d /git-mergetool--lib.sh
parent69759917aa4b1efb5bf198e76c3664bed9c70d4d (diff)
parenta427ef7acc9d932d1c203dd2fae67f51c4b1d1e8 (diff)
downloadgit-5ec11ab39d11aecd731044955a7a4f7e925cdba6.tar.gz
Merge branch 'da/mergetool-custom'
The actual external command to run for mergetool backend can be specified with difftool/mergetool.$name.cmd configuration variables, but this mechanism was ignored for the backends we natively support. * da/mergetool-custom: mergetool--lib: Allow custom commands to override built-ins
Diffstat (limited to 'git-mergetool--lib.sh')
-rw-r--r--git-mergetool--lib.sh40
1 files changed, 38 insertions, 2 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 54cb708254..f013a03506 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -104,13 +104,49 @@ run_merge_tool () {
if merge_mode
then
- merge_cmd "$1"
+ run_merge_cmd "$1"
else
- diff_cmd "$1"
+ run_diff_cmd "$1"
fi
return $status
}
+# Run a either a configured or built-in diff tool
+run_diff_cmd () {
+ merge_tool_cmd="$(get_merge_tool_cmd "$1")"
+ if test -n "$merge_tool_cmd"
+ then
+ ( eval $merge_tool_cmd )
+ status=$?
+ return $status
+ else
+ diff_cmd "$1"
+ fi
+}
+
+# Run a either a configured or built-in merge tool
+run_merge_cmd () {
+ merge_tool_cmd="$(get_merge_tool_cmd "$1")"
+ if test -n "$merge_tool_cmd"
+ then
+ trust_exit_code="$(git config --bool \
+ mergetool."$1".trustExitCode || echo false)"
+ if test "$trust_exit_code" = "false"
+ then
+ touch "$BACKUP"
+ ( eval $merge_tool_cmd )
+ status=$?
+ check_unchanged
+ else
+ ( eval $merge_tool_cmd )
+ status=$?
+ fi
+ return $status
+ else
+ merge_cmd "$1"
+ fi
+}
+
list_merge_tool_candidates () {
if merge_mode
then