* [PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode
@ 2021-08-08 3:38 Carlo Marcelo Arenas Belón
2021-08-09 18:13 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2021-08-08 3:38 UTC (permalink / raw)
To: git; +Cc: liu.denton, Carlo Marcelo Arenas Belón
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode
2021-08-08 3:38 [PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode Carlo Marcelo Arenas Belón
@ 2021-08-09 18:13 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2021-08-09 18:13 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belón; +Cc: git, liu.denton
On Sat, Aug 07, 2021 at 08:38:34PM -0700, Carlo Marcelo Arenas Belón wrote:
> 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
In general, if only an old version of a compiler complains, I'd prefer
to either silence it (by loosening the -W options in config.mak.dev for
systems without clang4), or just ignore it.
That said, in this case...
> - 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);
I think the result is actually easier to follow, as we can see that in
the CLEANUP_SCISSORS code we do not care about comment_line_char.
Thanks for the cleanup.
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-09 18:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-08 3:38 [PATCH] builtin/merge: avoid -Wformat-extra-args from ancient Xcode Carlo Marcelo Arenas Belón
2021-08-09 18:13 ` Jeff King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.