1
0
mirror of https://github.com/git/git.git synced 2024-10-21 09:18:12 +02:00

Merge branch 'fc/mergetool-prompt'

mergetool.prompt used to default to 'true', always causing a confirmation
"do you really want to run the tool on this path" to be shown.

Among the two purposes the prompt serves, ignore the use case to
confirm that the user wants to view particular path with the named
tool, and make the prompt only to confirm the choice of the tool
made by autodetection and defaulting.  For those who configured the
tool explicitly, the prompt shown for the latter purpose is simply
annoying.

Strictly speaking, this is a backward incompatible change and the
users need to explicitly set the variable to 'true' if they want to
resurrect the now-ignored use case.

* fc/mergetool-prompt:
  mergetool: document the default for --[no-]prompt
  mergetool: run prompt only if guessed tool
This commit is contained in:
Junio C Hamano 2014-06-03 12:06:44 -07:00
commit 7ea60c15cc
2 changed files with 16 additions and 6 deletions

@ -71,11 +71,13 @@ success of the resolution after the custom tool has exited.
--no-prompt:: --no-prompt::
Don't prompt before each invocation of the merge resolution Don't prompt before each invocation of the merge resolution
program. program.
This is the default if the merge resolution program is
explicitly specified with the `--tool` option or with the
`merge.tool` configuration variable.
--prompt:: --prompt::
Prompt before each invocation of the merge resolution program. Prompt before each invocation of the merge resolution program
This is the default behaviour; the option is provided to to give the user a chance to skip the path.
override any configuration settings.
TEMPORARY FILES TEMPORARY FILES
--------------- ---------------

@ -277,7 +277,7 @@ 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 if test "$guessed_merge_tool" = true || test "$prompt" = true
then 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 || return 1 read ans || return 1
@ -315,7 +315,8 @@ merge_file () {
return 0 return 0
} }
prompt=$(git config --bool mergetool.prompt || echo true) prompt=$(git config --bool mergetool.prompt)
guessed_merge_tool=false
while test $# != 0 while test $# != 0
do do
@ -373,7 +374,14 @@ prompt_after_failed_merge () {
if test -z "$merge_tool" if test -z "$merge_tool"
then then
merge_tool=$(get_merge_tool "$merge_tool") || exit # Check if a merge tool has been configured
merge_tool=$(get_configured_merge_tool)
# Try to guess an appropriate merge tool if no tool has been set.
if test -z "$merge_tool"
then
merge_tool=$(guess_merge_tool) || exit
guessed_merge_tool=true
fi
fi fi
merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)" merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)"
merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)" merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"