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

[PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
Aug 8, 2021, 03:38 UTC
Message-ID
<20210808033834.74470-1-carenas@gmail.com>

d540b70c85 (merge: cleanup messages like commit, 2019-04-17) adds a way to change part of the helper text using a single call to strbuf_add_commented_addf but with two formats with varying number of parameters.

this trigger a warning in old versions of Xcode (ex 8.0), so use instead two independent calls with a matching number of parameters

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 builtin/merge.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index eddb8ae70d..9f160f7eb9 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -861,9 +861,11 @@ static void prepare_to_commit(struct commit_list *remoteheads)
 			strbuf_commented_addf(&msg, "\n");
 		}
 		strbuf_commented_addf(&msg, _(merge_editor_comment));
-		strbuf_commented_addf(&msg, _(cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS ?
-			scissors_editor_comment :
-			no_scissors_editor_comment), comment_line_char);
+		if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS)
+			strbuf_commented_addf(&msg, _(scissors_editor_comment));
+		else
+			strbuf_commented_addf(&msg,
+				_(no_scissors_editor_comment), comment_line_char);
 	}
 	if (signoff)
 		append_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);
-- 
2.33.0.rc1.373.gc715f1a457
Next: Jeff King
Message 1 of 2 in “builtin/merge: avoid -Wformat-extra-args from ancient Xcode”
  1. builtin/merge: avoid -Wformat-extra-args from ancient XcodeCarlo Marcelo Arenas Belón, Aug 8, 2021
  2. Jeff KingAug 9, 2021

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.