git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Nicholas Guriev <guriev-ns@ya.ru>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] mergetool: don't suggest to continue after last file
Date: Mon, 13 Aug 2018 12:11:00 -0700	[thread overview]
Message-ID: <xmqq600e5bgb.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180813050929.5531-1-guriev-ns@ya.ru> (Nicholas Guriev's message of "Mon, 13 Aug 2018 08:09:29 +0300")

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

      reply	other threads:[~2018-08-13 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq600e5bgb.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=guriev-ns@ya.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).