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

Re: [PATCH 1/2] Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Jan 20, 2010, 16:10 UTC
Message-ID
<4B572AED.1040801@gmail.com>
In-Reply-To
<4B572870.6090001@viscovery.net>

This is for symmetry with git-difftool, and to make should_prompt_merge () reusable from within git-difftool--helper.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 git-mergetool--lib.sh |    9 +++++++++
 git-mergetool.sh      |    2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 5b62785..b0e4156 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -7,6 +7,15 @@ merge_mode() {
 	test "$TOOL_MODE" = merge
 }
 
+should_prompt_merge () {
+	prompt=$(git config --bool mergetool.prompt || echo true)
+	if test "$prompt" = true; then
+		test -z "$GIT_MERGETOOL_NO_PROMPT"
+	else
+		test -n "$GIT_MERGETOOL_PROMPT"
+	fi
+}
+
 translate_merge_tool_path () {
 	case "$1" in
 	vimdiff)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index b52a741..69f1627 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -202,7 +202,7 @@ merge_file () {
     return 0
 }
 
-prompt=$(git config --bool mergetool.prompt || echo true)
+prompt=$(should_prompt_merge && echo true || echo false)
 
 while test $# != 0
 do
-- 
1.6.6.266.g55d982.dirty
Previous: Johannes SixtNext: David Aguilar
Message 3 of 6 in “Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPT”
  1. 1/2 Allow to override mergetool.prompt with $GIT_MERGETOOL*_PROMPTSebastian Schuberth, Jan 20, 2010
  2. Johannes SixtJan 20, 2010
  3. Sebastian SchuberthJan 20, 2010
  4. David AguilarJan 21, 2010
  5. Sebastian SchuberthJan 21, 2010
  6. David AguilarJan 22, 2010

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.