Subject: [PATCH 9/7] mergetool--lib: fix path lookup in guess_merge_tool

From: John Keeping <[email-masked]>
Date: Fri, 25 Jan 2013 22:04:42 +0000

guess_merge_tool calls translate_merge_tool_path in order to get the
correct name of the tool to check whether it can be found on the user's
system.  But this function is designed to be overridden by tool
scriptlets so it does nothing if the relevant scriptlet has not been
sourced.

Fix this by calling setup_tool before doing anything.

Signed-off-by: John Keeping <[email-masked]>
---
 git-mergetool--lib.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index c6bd8ba..46860c5 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -219,6 +219,7 @@ guess_merge_tool () {
 	# Loop over each candidate and stop when a valid merge tool is found.
 	for i in $tools
 	do
+		setup_tool "$i" 2>&1 || continue
 		merge_tool_path="$(translate_merge_tool_path "$i")"
 		if type "$merge_tool_path" >/dev/null 2>&1
 		then
-- 
1.8.1