t6300: add more body-parsing tests
[gitweb.git] / git-difftool--helper.sh
index 69f6bcebcbc32a7d34731677cd1baa9fea473085..8452890be974d30942f0acaa3f19282c1b8b25b2 100755 (executable)
@@ -3,7 +3,7 @@
 # This script is typically launched by using the 'git difftool'
 # convenience command.
 #
-# Copyright (c) 2009-2010 David Aguilar
+# Copyright (c) 20092010 David Aguilar
 
 TOOL_MODE=diff
 . git-mergetool--lib
@@ -11,8 +11,10 @@ TOOL_MODE=diff
 # difftool.prompt controls the default prompt/no-prompt behavior
 # and is overridden with $GIT_DIFFTOOL*_PROMPT.
 should_prompt () {
-       prompt=$(git config --bool difftool.prompt || echo true)
-       if test "$prompt" = true; then
+       prompt_merge=$(git config --bool mergetool.prompt || echo true)
+       prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
+       if test "$prompt" = true
+       then
                test -z "$GIT_DIFFTOOL_NO_PROMPT"
        else
                test -n "$GIT_DIFFTOOL_PROMPT"
@@ -36,9 +38,11 @@ launch_merge_tool () {
 
        # $LOCAL and $REMOTE are temporary files so prompt
        # the user with the real $MERGED name before launching $merge_tool.
-       if should_prompt; then
+       if should_prompt
+       then
                printf "\nViewing: '$MERGED'\n"
-               if use_ext_cmd; then
+               if use_ext_cmd
+               then
                        printf "Hit return to launch '%s': " \
                                "$GIT_DIFFTOOL_EXTCMD"
                else
@@ -47,15 +51,19 @@ launch_merge_tool () {
                read ans
        fi
 
-       if use_ext_cmd; then
+       if use_ext_cmd
+       then
+               export BASE
                eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
        else
                run_merge_tool "$merge_tool"
        fi
 }
 
-if ! use_ext_cmd; then
-       if test -n "$GIT_DIFF_TOOL"; then
+if ! use_ext_cmd
+then
+       if test -n "$GIT_DIFF_TOOL"
+       then
                merge_tool="$GIT_DIFF_TOOL"
        else
                merge_tool="$(get_merge_tool)" || exit