mergetool: don't suggest to continue after last file
Eliminate an unnecessary prompt to continue after failed merger, by not calling the prompt_after_failed_merge function when only one iteration remains. Uses positional parameters to count files in the list to make it easier to see if we have any more paths to process from within the loop. Signed-off-by: Nicholas Guriev <guriev-ns@ya.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nicholas Guriev committed
Aug 13, 2018 at 08:09 UTC
d651a54b8a22a307f5b061ba50c5348ae31e861c
1 file changed
+5
-3
git-mergetool.sh
+5
-3
@@ -491,14 +491,16 @@ main () {
491
printf "%s\n" "$files"
492
493
rc=0
494
- for i in $files
494
+ set -- $files
495
+ while test $# -ne 0
496
do
497
printf "\n"
497
- if ! merge_file "$i"
498
+ if ! merge_file "$1"
499
then
500
rc=1
500
- prompt_after_failed_merge || exit 1
501
+ test $# -ne 1 && prompt_after_failed_merge || exit 1
502
fi
503
+ shift
504
done
505
506
exit $rc