From: Charles Bailey <charles@hashpling.org>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
William Pursell <bill.pursell@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
"Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH 2/3] Add -n/--no-prompt option to mergetool
Date: Tue, 21 Oct 2008 11:13:18 +0100 [thread overview]
Message-ID: <1224583999-26279-2-git-send-email-charles@hashpling.org> (raw)
In-Reply-To: <1224583999-26279-1-git-send-email-charles@hashpling.org>
This option lets git mergetool invoke the conflict resolution program
without waiting for a user response each time.
Also added a mergetool.prompt (default true) configuration variable
controlling the same behaviour.
Signed-off-by: Charles Bailey <charles@hashpling.org>
---
Documentation/config.txt | 3 +++
Documentation/git-mergetool.txt | 11 ++++++++++-
git-mergetool.sh | 16 +++++++++++++---
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 29369d0..b4e4ee4 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -976,6 +976,9 @@ mergetool.keepBackup::
is set to `false` then this file is not preserved. Defaults to
`true` (i.e. keep the backup files).
+mergetool.prompt::
+ Prompt before each invocation of the merge resolution program.
+
pack.window::
The size of the window used by linkgit:git-pack-objects[1] when no
window size is given on the command line. Defaults to 10.
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index e0b2703..6d6bfe0 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -7,7 +7,7 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
SYNOPSIS
--------
-'git mergetool' [--tool=<tool>] [<file>]...
+'git mergetool' [--tool=<tool>] [-n|--no-prompt|--prompt] [<file>]...
DESCRIPTION
-----------
@@ -60,6 +60,15 @@ variable `mergetool.<tool>.trustExitCode` can be set to `true`.
Otherwise, 'git-mergetool' will prompt the user to indicate the
success of the resolution after the custom tool has exited.
+-n or --no-prompt::
+ Don't prompt before each invocation of the merge resolution
+ program.
+
+--prompt::
+ Prompt before each invocation of the merge resolution program.
+ This is the default behaviour; the option is provided to
+ override any configuration settings.
+
Author
------
Written by Theodore Y Ts'o <tytso@mit.edu>
diff --git a/git-mergetool.sh b/git-mergetool.sh
index e2da5fc..8bc5366 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -8,7 +8,7 @@
# at the discretion of Junio C Hamano.
#
-USAGE='[--tool=tool] [file to merge] ...'
+USAGE='[--tool=tool] [-n|--no-prompt|--prompt] [file to merge] ...'
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
. git-sh-setup
@@ -176,8 +176,10 @@ merge_file () {
echo "Normal merge conflict for '$MERGED':"
describe_file "$local_mode" "local" "$LOCAL"
describe_file "$remote_mode" "remote" "$REMOTE"
- printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
- read ans
+ if "$prompt" = true; then
+ printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
+ read ans
+ fi
case "$merge_tool" in
kdiff3)
@@ -280,6 +282,8 @@ merge_file () {
cleanup_temp_files
}
+prompt=$(git config --bool mergetool.prompt || echo true)
+
while test $# != 0
do
case "$1" in
@@ -295,6 +299,12 @@ do
shift ;;
esac
;;
+ -n|--no-prompt)
+ prompt=false
+ ;;
+ --prompt)
+ prompt=true
+ ;;
--)
break
;;
--
1.6.0.2.534.g5ab59
next prev parent reply other threads:[~2008-10-21 10:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 10:13 [PATCH 1/3] Fix some tab/space inconsistencies in git-mergetool.sh Charles Bailey
2008-10-21 10:13 ` Charles Bailey [this message]
2008-10-21 10:13 ` [PATCH 3/3] Add -k/--keep-going option to mergetool Charles Bailey
2008-10-21 11:12 ` Jeff King
2008-10-21 11:49 ` [PATCH 2/3] Add -n/--no-prompt " Andreas Ericsson
2008-10-21 12:26 ` Charles Bailey
2008-10-22 21:17 ` Charles Bailey
2008-10-22 23:21 ` Junio C Hamano
2008-10-23 6:44 ` Charles Bailey
2008-10-24 22:32 ` William Pursell
2008-10-24 22:55 ` Charles Bailey
2008-10-25 10:11 ` William Pursell
2008-11-13 12:28 ` Charles Bailey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1224583999-26279-2-git-send-email-charles@hashpling.org \
--to=charles@hashpling.org \
--cc=bill.pursell@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.