Thread (8 messages) flat view 8 messages, 3 authors, 2016-06-15
DORMANTno replies

[PATCH 1/2 v2] mergetool--lib: don't call "exit" in setup_tool

From: John Keeping <hidden>
Date: 2016-06-15 22:55:54
Subsystem: the rest · Maintainer: Linus Torvalds

This will make it easier to use setup_tool in places where we expect
that the selected tool will not support the current mode.

Signed-off-by: John Keeping <redacted>
---
On Fri, Jan 25, 2013 at 04:24:03PM -0800, Junio C Hamano wrote:
Applying this one on top of 1/7 thru 5/7 and 7/7 seems to break
t7610 rather badly.
Sorry about that.  The 'setup_tool' function should really be called
'setup_builtin_tool' - it isn't necessary when a custom mergetool is
configured and will return 1 when called with an argument that isn't a
builtin tool from $GIT_EXEC_PATH/mergetools.

The change is the second hunk below which now wraps the call to
setup_tool in an if block as well as adding the "|| return".

 git-mergetool--lib.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 4c1e129..8a5eaff 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -67,11 +67,11 @@ setup_tool () {
 	if merge_mode && ! can_merge
 	then
 		echo "error: '$tool' can not be used to resolve merges" >&2
-		exit 1
+		return 1
 	elif diff_mode && ! can_diff
 	then
 		echo "error: '$tool' can only be used to resolve merges" >&2
-		exit 1
+		return 1
 	fi
 	return 0
 }
@@ -100,7 +100,10 @@ run_merge_tool () {
 	status=0
 
 	# Bring tool-specific functions into scope
-	setup_tool "$1"
+	if test -z "$merge_tool_path"
+	then
+		setup_tool "$1" || return
+	fi
 
 	if merge_mode
 	then
-- 
1.8.1.1.367.ga9c3dd4.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help