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

[PATCH 5/8] difftool: refactor git-difftool to use git-sh-tools

From
David Aguilar <davvid@gmail.com>
Date
Mar 30, 2009, 05:03 UTC
Message-ID
<1238389428-69328-6-git-send-email-davvid@gmail.com>
In-Reply-To
<1238389428-69328-5-git-send-email-davvid@gmail.com>
This removes the common valid_tool functions from git-difftool.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-difftool-helper.sh |   45 +++------------------------------------------
 1 files changed, 3 insertions(+), 42 deletions(-)
diff --git a/git-difftool-helper.sh b/git-difftool-helper.sh
index 02bb135..2051a35 100755
--- a/git-difftool-helper.sh
+++ b/git-difftool-helper.sh
@@ -7,6 +7,9 @@
 #
 # Copyright (c) 2009 David Aguilar
 
+TOOL_MODE=diff
+. git-sh-tools
+
 # difftool.prompt controls the default prompt/no-prompt behavior
 # and is overridden with $GIT_DIFFTOOL*_PROMPT.
 should_prompt () {
@@ -102,48 +105,6 @@ launch_merge_tool () {
 	esac
 }
 
-# Verifies that (difftool|mergetool).<tool>.cmd exists
-valid_custom_tool() {
-	merge_tool_cmd="$(git config difftool.$1.cmd)"
-	test -z "$merge_tool_cmd" &&
-	merge_tool_cmd="$(git config mergetool.$1.cmd)"
-	test -n "$merge_tool_cmd"
-}
-
-# Verifies that the chosen merge tool is properly setup.
-# Built-in merge tools are always valid.
-valid_tool() {
-	case "$1" in
-	kdiff3 | kompare | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge)
-		;; # happy
-	*)
-		if ! valid_custom_tool "$1"
-		then
-			return 1
-		fi
-		;;
-	esac
-}
-
-# Sets up the merge_tool_path variable.
-# This handles the difftool.<tool>.path configuration.
-# This also falls back to mergetool defaults.
-init_merge_tool_path() {
-	merge_tool_path=$(git config difftool."$1".path)
-	test -z "$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
-}
-
 # Allow GIT_DIFF_TOOL and GIT_MERGE_TOOL to provide default values
 test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
 test -n "$GIT_DIFF_TOOL" && merge_tool="$GIT_DIFF_TOOL"
-- 
1.6.1.3
Previous: David AguilarNext: David Aguilar
Message 6 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.