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

[PATCH 3/4] git-mergetool: don't hardcode 'mergetool' in show_tool_help

From
John Keeping <john@keeping.me.uk>
Date
Jan 24, 2013, 19:55 UTC
Message-ID
<bbf604e6903a23c5c8e7b920b38175a39564f946.1359057056.git.john@keeping.me.uk>
In-Reply-To
<cover.1359057056.git.john@keeping.me.uk>

When using show_tool_help from git-difftool we will want it to print "git difftool" not "git mergetool" so use "git ${TOOL_MODE}tool".

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 git-mergetool--lib.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 1748315..4c1e129 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -188,12 +188,14 @@ show_tool_help () {
 			unavailable="$unavailable$i$LF"
 		fi
 	done
+
+	cmd_name=${TOOL_MODE}tool
 	if test -n "$available"
 	then
-		echo "'git mergetool --tool=<tool>' may be set to one of the following:"
+		echo "'git $cmd_name --tool=<tool>' may be set to one of the following:"
 		echo "$available" | sort | sed -e 's/^/	/'
 	else
-		echo "No suitable tool for 'git mergetool --tool=<tool>' found."
+		echo "No suitable tool for 'git $cmd_name --tool=<tool>' found."
 	fi
 	if test -n "$unavailable"
 	then
-- 
1.8.1
Previous: John KeepingNext: John Keeping
Message 4 of 10 in “Fix "git difftool --tool-help"”
  1. 0/4 Fix "git difftool --tool-help"John Keeping, Jan 24, 2013
  2. 1/4 git-mergetool: move show_tool_help to mergetool--libJohn Keeping, Jan 24, 2013
  3. 2/4 git-mergetool: remove redundant assignmentJohn Keeping, Jan 24, 2013
  4. 3/4 git-mergetool: don't hardcode 'mergetool' in show_tool_helpJohn Keeping, Jan 24, 2013
  5. 4/4 git-difftool: use git-mergetool--lib for "--tool-help"John Keeping, Jan 24, 2013
  6. David AguilarJan 25, 2013
  7. John KeepingJan 25, 2013
  8. David AguilarJan 25, 2013
  9. John KeepingJan 25, 2013
  10. Junio C HamanoJan 24, 2013

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.