* [PATCH] mergetool: don't suggest to continue after last file
@ 2018-08-13 5:09 Nicholas Guriev
2018-08-13 19:11 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Guriev @ 2018-08-13 5:09 UTC (permalink / raw)
To: Git List; +Cc: Nicholas Guriev
This eliminates an unnecessary prompt to continue after failed merger.
The patch uses positional parameters to count files in the list. If only
one iteration is remained, the prompt_after_failed_merge function is not
called.
Signed-off-by: Nicholas Guriev <guriev-ns@ya.ru>
---
git-mergetool.sh | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index c062e3d..d07c7f3 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -491,14 +491,16 @@ main () {
printf "%s\n" "$files"
rc=0
- for i in $files
+ set -- $files
+ while test $# -ne 0
do
printf "\n"
- if ! merge_file "$i"
+ if ! merge_file "$1"
then
rc=1
- prompt_after_failed_merge || exit 1
+ test $# -ne 1 && prompt_after_failed_merge || exit 1
fi
+ shift
done
exit $rc
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mergetool: don't suggest to continue after last file
2018-08-13 5:09 [PATCH] mergetool: don't suggest to continue after last file Nicholas Guriev
@ 2018-08-13 19:11 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-08-13 19:11 UTC (permalink / raw)
To: Nicholas Guriev; +Cc: Git List
Nicholas Guriev <guriev-ns@ya.ru> writes:
> This eliminates an unnecessary prompt to continue after failed merger.
> The patch uses positional parameters to count files in the list. If only
> one iteration is remained, the prompt_after_failed_merge function is not
s/is remained/remains/, I think.
Other than that, nicely done and nicely explained.
Thanks; will queue.
> called.
>
> Signed-off-by: Nicholas Guriev <guriev-ns@ya.ru>
> ---
> git-mergetool.sh | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index c062e3d..d07c7f3 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -491,14 +491,16 @@ main () {
> printf "%s\n" "$files"
>
> rc=0
> - for i in $files
> + set -- $files
> + while test $# -ne 0
> do
> printf "\n"
> - if ! merge_file "$i"
> + if ! merge_file "$1"
> then
> rc=1
> - prompt_after_failed_merge || exit 1
> + test $# -ne 1 && prompt_after_failed_merge || exit 1
> fi
> + shift
> done
>
> exit $rc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-13 19:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 5:09 [PATCH] mergetool: don't suggest to continue after last file Nicholas Guriev
2018-08-13 19:11 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).