[PATCH 04/10] mergetool: use get_mergetool_path from git-mergetool-lib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This refactors git-mergetool to use get_mergetool_path().

Signed-off-by: David Aguilar <davvid@xxxxxxxxx>
---
 git-mergetool.sh |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 7c04031..732a5b7 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -12,6 +12,7 @@ USAGE='[--tool=tool] [-y|--no-prompt|--prompt] [file to merge] ...'
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
 . git-sh-setup
+. git-mergetool-lib
 require_work_tree
 
 # Returns true if the mode reflects a symlink
@@ -355,20 +356,6 @@ valid_tool() {
 	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) ? "
@@ -412,7 +399,7 @@ if test -z "$merge_tool" ; then
     fi
     echo "merge tool candidates: $merge_tool_candidates"
     for i in $merge_tool_candidates; do
-        init_merge_tool_path $i
+        merge_tool_path="$(get_merge_tool_path "$i" "$merge_tool_path")"
         if type "$merge_tool_path" > /dev/null 2>&1; then
             merge_tool=$i
             break
@@ -428,8 +415,7 @@ else
         exit 1
     fi
 
-    init_merge_tool_path "$merge_tool"
-
+    merge_tool_path="$(get_merge_tool_path "$merge_tool")"
     merge_keep_backup="$(git config --bool merge.keepBackup || echo true)"
     merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
 
-- 
1.6.1.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux