mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
strbuf: accept a comment string for strbuf_commented_addf()
As part of our transition to multi-byte comment characters, let's take a NUL-terminated string pointer for strbuf_commented_addf() rather than a single character. All of the callers have to be adjusted, but they can just pass comment_line_str rather than comment_line_char. Note that we rely on strbuf_add_commented_lines() under the hood, so we'll cheat a bit to squeeze our string into a single character (for now the two are equivalent, and we'll address this TODO in the next patch). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
2982b65690
commit
3a35d96284
@@ -291,10 +291,10 @@ static void create_tag(const struct object_id *object, const char *object_ref,
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
strbuf_addch(&buf, '\n');
|
||||
if (opt->cleanup_mode == CLEANUP_ALL)
|
||||
strbuf_commented_addf(&buf, comment_line_char,
|
||||
strbuf_commented_addf(&buf, comment_line_str,
|
||||
_(tag_template), tag, comment_line_char);
|
||||
else
|
||||
strbuf_commented_addf(&buf, comment_line_char,
|
||||
strbuf_commented_addf(&buf, comment_line_str,
|
||||
_(tag_template_nocleanup), tag, comment_line_char);
|
||||
write_or_die(fd, buf.buf, buf.len);
|
||||
strbuf_release(&buf);
|
||||
|
||||
Reference in New Issue
Block a user