{"thread":{"id":"49106","subject":"[PATCH] mergetool: don't suggest to continue after last file","startedAt":"2018-08-13T05:22:18Z","lastAt":"2018-08-13T19:11:04Z","messageCount":2,"participants":["Nicholas Guriev","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"355306","messageId":"20180813050929.5531-1-guriev-ns@ya.ru","threadId":"49106","inReplyTo":null,"subject":"[PATCH] mergetool: don't suggest to continue after last file","fromName":"Nicholas Guriev","fromEmail":"guriev-ns@ya.ru","sentAt":"2018-08-13T05:09:29Z","receivedAt":"2018-08-13T05:22:18Z","isPatch":true,"sender":{"key":"guriev-ns@ya.ru","avatar":"https://avatars.githubusercontent.com/u/9163157?v=4"},"body":"This eliminates an unnecessary prompt to continue after failed merger.\nThe patch uses positional parameters to count files in the list. If only\none iteration is remained, the prompt_after_failed_merge function is not\ncalled.\n\nSigned-off-by: Nicholas Guriev <guriev-ns@ya.ru>\n---\n git-mergetool.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex c062e3d..d07c7f3 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -491,14 +491,16 @@ main () {\n \tprintf \"%s\\n\" \"$files\"\n \n \trc=0\n-\tfor i in $files\n+\tset -- $files\n+\twhile test $# -ne 0\n \tdo\n \t\tprintf \"\\n\"\n-\t\tif ! merge_file \"$i\"\n+\t\tif ! merge_file \"$1\"\n \t\tthen\n \t\t\trc=1\n-\t\t\tprompt_after_failed_merge || exit 1\n+\t\t\ttest $# -ne 1 && prompt_after_failed_merge || exit 1\n \t\tfi\n+\t\tshift\n \tdone\n \n \texit $rc\n-- \n2.7.4\n\n"},{"id":"355453","messageId":"xmqq600e5bgb.fsf@gitster-ct.c.googlers.com","threadId":"49106","inReplyTo":"20180813050929.5531-1-guriev-ns@ya.ru","subject":"Re: [PATCH] mergetool: don't suggest to continue after last file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-13T19:11:00Z","receivedAt":"2018-08-13T19:11:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicholas Guriev <guriev-ns@ya.ru> writes:\n\n> This eliminates an unnecessary prompt to continue after failed merger.\n> The patch uses positional parameters to count files in the list. If only\n> one iteration is remained, the prompt_after_failed_merge function is not\n\ns/is remained/remains/, I think.\n\nOther than that, nicely done and nicely explained.\n\nThanks; will queue.\n\n> called.\n>\n> Signed-off-by: Nicholas Guriev <guriev-ns@ya.ru>\n> ---\n>  git-mergetool.sh | 8 +++++---\n>  1 file changed, 5 insertions(+), 3 deletions(-)\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index c062e3d..d07c7f3 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -491,14 +491,16 @@ main () {\n>  \tprintf \"%s\\n\" \"$files\"\n>  \n>  \trc=0\n> -\tfor i in $files\n> +\tset -- $files\n> +\twhile test $# -ne 0\n>  \tdo\n>  \t\tprintf \"\\n\"\n> -\t\tif ! merge_file \"$i\"\n> +\t\tif ! merge_file \"$1\"\n>  \t\tthen\n>  \t\t\trc=1\n> -\t\t\tprompt_after_failed_merge || exit 1\n> +\t\t\ttest $# -ne 1 && prompt_after_failed_merge || exit 1\n>  \t\tfi\n> +\t\tshift\n>  \tdone\n>  \n>  \texit $rc\n"}]}