Imported Upstream version 2.12.5
[platform/upstream/git.git] / git-difftool--helper.sh
index 3d0fe0c..7bfb673 100755 (executable)
@@ -40,15 +40,17 @@ launch_merge_tool () {
        # the user with the real $MERGED name before launching $merge_tool.
        if should_prompt
        then
-               printf "\nViewing: '$MERGED'\n"
+               printf "\nViewing (%s/%s): '%s'\n" "$GIT_DIFF_PATH_COUNTER" \
+                       "$GIT_DIFF_PATH_TOTAL" "$MERGED"
                if use_ext_cmd
                then
-                       printf "Launch '%s' [Y/n]: " \
+                       printf "Launch '%s' [Y/n]? " \
                                "$GIT_DIFFTOOL_EXTCMD"
                else
-                       printf "Launch '%s' [Y/n]: " "$merge_tool"
+                       printf "Launch '%s' [Y/n]? " "$merge_tool"
                fi
-               if read ans && test "$ans" = n
+               read ans || return
+               if test "$ans" = n
                then
                        return
                fi
@@ -83,6 +85,21 @@ else
        while test $# -gt 6
        do
                launch_merge_tool "$1" "$2" "$5"
+               status=$?
+               if test $status -ge 126
+               then
+                       # Command not found (127), not executable (126) or
+                       # exited via a signal (>= 128).
+                       exit $status
+               fi
+
+               if test "$status" != 0 &&
+                       test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
+               then
+                       exit $status
+               fi
                shift 7
        done
 fi
+
+exit 0