git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
David Aguilar <davvid@gmail.com>
Date
Mar 30, 2009, 05:03 UTC
Message-ID
<1238389428-69328-5-git-send-email-davvid@gmail.com>
In-Reply-To
<1238389428-69328-4-git-send-email-davvid@gmail.com>
This removes the common valid_tool functions from git-mergetool.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 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
Previous: David AguilarNext: David Aguilar
Message 5 of 19 in “(unknown)”
  1. David AguilarMar 30, 2009
  2. 1/8 mergetool: use tabs consistentlyDavid Aguilar, Mar 30, 2009
  3. 2/8 mergetool: use $( ... ) instead of `backticks`David Aguilar, Mar 30, 2009
  4. 3/8 sh-tools: add a git-sh-tools shell helper scriptDavid Aguilar, Mar 30, 2009
  5. 4/8 mergetool: refactor git-mergetool to use git-sh-toolsDavid Aguilar, Mar 30, 2009
  6. 5/8 difftool: refactor git-difftool to use git-sh-toolsDavid Aguilar, Mar 30, 2009
  7. 6/8 sh-tools: add a run_merge_tool functionDavid Aguilar, Mar 30, 2009
  8. 7/8 mergetool: refactor git-mergetool to use run_merge_toolDavid Aguilar, Mar 30, 2009
  9. 8/8 difftool: refactor git-difftool-helper to use run_merge_toolDavid Aguilar, Mar 30, 2009
  10. Markus HeidelbergMar 30, 2009
  11. Markus HeidelbergMar 30, 2009
  12. David AguilarMar 30, 2009
  13. Junio C HamanoMar 30, 2009
  14. David AguilarMar 30, 2009
  15. Charles BaileyMar 30, 2009
  16. David AguilarMar 31, 2009
  17. Junio C HamanoApr 1, 2009
  18. Markus HeidelbergMar 30, 2009
  19. Junio C HamanoMar 30, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.