aboutsummaryrefslogtreecommitdiff
path: root/git-mergetool--lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-mergetool--lib.sh')
-rw-r--r--git-mergetool--lib.sh42
1 files changed, 39 insertions, 3 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index f730253c0..f013a0350 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
@@ -126,7 +162,7 @@ list_merge_tool_candidates () {
else
tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
fi
- tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3"
+ tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare"
fi
case "${VISUAL:-$EDITOR}" in
*vim*)