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

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

From
Nicholas Guriev <guriev-ns@ya.ru>
Date
Aug 13, 2018, 05:09 UTC
Message-ID
<20180813050929.5531-1-guriev-ns@ya.ru>

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
Next: Junio C Hamano
Message 1 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.