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

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

 



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@xxxxxxxxx>
---
 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

--
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]