git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] mergetool: don't suggest to continue after last file

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 13, 2018, 19:11 UTC
Message-ID
<xmqq600e5bgb.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180813050929.5531-1-guriev-ns@ya.ru>
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.
Show 31 quoted lines
> 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
Previous: Nicholas Guriev
Message 2 of 2 in “mergetool: don't suggest to continue after last file”
  1. mergetool: don't suggest to continue after last fileNicholas Guriev, Aug 13, 2018
  2. Junio C HamanoAug 13, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.