Add -y/--no-prompt option to mergetool
This option lets git mergetool invoke the conflict resolution program without waiting for a user prompt each time. Also added a mergetool.prompt (default true) configuration variable controlling the same behaviour Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0eea345111
commit
682b451f84
@ -976,6 +976,9 @@ mergetool.keepBackup::
|
|||||||
is set to `false` then this file is not preserved. Defaults to
|
is set to `false` then this file is not preserved. Defaults to
|
||||||
`true` (i.e. keep the backup files).
|
`true` (i.e. keep the backup files).
|
||||||
|
|
||||||
|
mergetool.prompt::
|
||||||
|
Prompt before each invocation of the merge resolution program.
|
||||||
|
|
||||||
pack.window::
|
pack.window::
|
||||||
The size of the window used by linkgit:git-pack-objects[1] when no
|
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.
|
window size is given on the command line. Defaults to 10.
|
||||||
|
@ -7,7 +7,7 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git mergetool' [--tool=<tool>] [<file>]...
|
'git mergetool' [--tool=<tool>] [-y|--no-prompt|--prompt] [<file>]...
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@ -60,6 +60,15 @@ variable `mergetool.<tool>.trustExitCode` can be set to `true`.
|
|||||||
Otherwise, 'git-mergetool' will prompt the user to indicate the
|
Otherwise, 'git-mergetool' will prompt the user to indicate the
|
||||||
success of the resolution after the custom tool has exited.
|
success of the resolution after the custom tool has exited.
|
||||||
|
|
||||||
|
-y 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
|
Author
|
||||||
------
|
------
|
||||||
Written by Theodore Y Ts'o <tytso@mit.edu>
|
Written by Theodore Y Ts'o <tytso@mit.edu>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# at the discretion of Junio C Hamano.
|
# at the discretion of Junio C Hamano.
|
||||||
#
|
#
|
||||||
|
|
||||||
USAGE='[--tool=tool] [file to merge] ...'
|
USAGE='[--tool=tool] [-y|--no-prompt|--prompt] [file to merge] ...'
|
||||||
SUBDIRECTORY_OK=Yes
|
SUBDIRECTORY_OK=Yes
|
||||||
OPTIONS_SPEC=
|
OPTIONS_SPEC=
|
||||||
. git-sh-setup
|
. git-sh-setup
|
||||||
@ -176,8 +176,10 @@ merge_file () {
|
|||||||
echo "Normal merge conflict for '$MERGED':"
|
echo "Normal merge conflict for '$MERGED':"
|
||||||
describe_file "$local_mode" "local" "$LOCAL"
|
describe_file "$local_mode" "local" "$LOCAL"
|
||||||
describe_file "$remote_mode" "remote" "$REMOTE"
|
describe_file "$remote_mode" "remote" "$REMOTE"
|
||||||
|
if "$prompt" = true; then
|
||||||
printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
|
printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
|
||||||
read ans
|
read ans
|
||||||
|
fi
|
||||||
|
|
||||||
case "$merge_tool" in
|
case "$merge_tool" in
|
||||||
kdiff3)
|
kdiff3)
|
||||||
@ -280,6 +282,8 @@ merge_file () {
|
|||||||
cleanup_temp_files
|
cleanup_temp_files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt=$(git config --bool mergetool.prompt || echo true)
|
||||||
|
|
||||||
while test $# != 0
|
while test $# != 0
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -295,6 +299,12 @@ do
|
|||||||
shift ;;
|
shift ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
-y|--no-prompt)
|
||||||
|
prompt=false
|
||||||
|
;;
|
||||||
|
--prompt)
|
||||||
|
prompt=true
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user