@ -13,7 +13,8 @@ TOOL_MODE=diff
should_prompt () {
should_prompt () {
prompt_merge=$(git config --bool mergetool.prompt || echo true)
prompt_merge=$(git config --bool mergetool.prompt || echo true)
prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
if test "$prompt" = true; then
if test "$prompt" = true
then
test -z "$GIT_DIFFTOOL_NO_PROMPT"
test -z "$GIT_DIFFTOOL_NO_PROMPT"
else
else
test -n "$GIT_DIFFTOOL_PROMPT"
test -n "$GIT_DIFFTOOL_PROMPT"
@ -37,9 +38,11 @@ launch_merge_tool () {
# $LOCAL and $REMOTE are temporary files so prompt
# $LOCAL and $REMOTE are temporary files so prompt
# the user with the real $MERGED name before launching $merge_tool.
# the user with the real $MERGED name before launching $merge_tool.
if should_prompt; then
if should_prompt
then
printf "\nViewing: '$MERGED'\n"
printf "\nViewing: '$MERGED'\n"
if use_ext_cmd; then
if use_ext_cmd
then
printf "Hit return to launch '%s': " \
printf "Hit return to launch '%s': " \
"$GIT_DIFFTOOL_EXTCMD"
"$GIT_DIFFTOOL_EXTCMD"
else
else
@ -48,7 +51,8 @@ launch_merge_tool () {
read ans
read ans
fi
fi
if use_ext_cmd; then
if use_ext_cmd
then
export BASE
export BASE
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
else
else
@ -56,8 +60,10 @@ launch_merge_tool () {
fi
fi
}
}
if ! use_ext_cmd; then
if ! use_ext_cmd
if test -n "$GIT_DIFF_TOOL"; then
then
if test -n "$GIT_DIFF_TOOL"
then
merge_tool="$GIT_DIFF_TOOL"
merge_tool="$GIT_DIFF_TOOL"
else
else
merge_tool="$(get_merge_tool)" || exit
merge_tool="$(get_merge_tool)" || exit