Subject: [PATCH 4/8] mergetool: refactor git-mergetool to use git-sh-tools

From: David Aguilar <[email-masked]>
Date: Sun, 29 Mar 2009 22:03:44 -0700

This removes the common valid_tool functions from git-mergetool.

Signed-off-by: David Aguilar <[email-masked]>
---
 git-mergetool.sh |   35 ++---------------------------------
 1 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 5ea126c..ec20030 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -11,7 +11,9 @@
 USAGE='[--tool=tool] [-y|--no-prompt|--prompt] [file to merge] ...'
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
+TOOL_MODE=merge
 . git-sh-setup
+. git-sh-tools
 require_work_tree
 
 # Returns true if the mode reflects a symlink
@@ -351,39 +353,6 @@ do
 	shift
 done
 
-valid_custom_tool()
-{
-	merge_tool_cmd="$(git config mergetool.$1.cmd)"
-	test -n "$merge_tool_cmd"
-}
-
-valid_tool() {
-	case "$1" in
-		kdiff3 | tkdiff | xxdiff | meld | opendiff | \
-		emerge | vimdiff | gvimdiff | ecmerge)
-			;; # happy
-		*)
-			if ! valid_custom_tool "$1"; then
-				return 1
-			fi
-			;;
-	esac
-}
-
-init_merge_tool_path() {
-	merge_tool_path=$(git config mergetool.$1.path)
-	if test -z "$merge_tool_path" ; then
-		case "$1" in
-			emerge)
-				merge_tool_path=emacs
-				;;
-			*)
-				merge_tool_path=$1
-				;;
-		esac
-	fi
-}
-
 prompt_after_failed_merge() {
 	while true; do
 		printf "Continue merging other unresolved paths (y/n) ? "
-- 
1.6.1.3