Merge branch 'jk/core-comment-string'
core.commentChar used to be limited to a single byte, but has been updated to allow an arbitrary multi-byte sequence. * jk/core-comment-string: config: add core.commentString config: allow multi-byte core.commentChar environment: drop comment_line_char compatibility macro wt-status: drop custom comment-char stringification sequencer: handle multi-byte comment characters when writing todo list find multi-byte comment chars in unterminated buffers find multi-byte comment chars in NUL-terminated strings prefer comment_line_str to comment_line_char for printing strbuf: accept a comment string for strbuf_add_commented_lines() strbuf: accept a comment string for strbuf_commented_addf() strbuf: accept a comment string for strbuf_stripspace() environment: store comment_line_char as a string strbuf: avoid shadowing global comment_line_char name commit: refactor base-case of adjust_comment_line_char() strbuf: avoid static variables in strbuf_add_commented_lines() strbuf: simplify comment-handling in add_lines() helper config: forbid newline as core.commentChar
This commit is contained in:
@ -193,11 +193,11 @@ out:
|
||||
|
||||
static const char tag_template[] =
|
||||
N_("\nWrite a message for tag:\n %s\n"
|
||||
"Lines starting with '%c' will be ignored.\n");
|
||||
"Lines starting with '%s' will be ignored.\n");
|
||||
|
||||
static const char tag_template_nocleanup[] =
|
||||
N_("\nWrite a message for tag:\n %s\n"
|
||||
"Lines starting with '%c' will be kept; you may remove them"
|
||||
"Lines starting with '%s' will be kept; you may remove them"
|
||||
" yourself if you want to.\n");
|
||||
|
||||
static int git_tag_config(const char *var, const char *value,
|
||||
@ -328,11 +328,11 @@ 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,
|
||||
_(tag_template), tag, comment_line_char);
|
||||
strbuf_commented_addf(&buf, comment_line_str,
|
||||
_(tag_template), tag, comment_line_str);
|
||||
else
|
||||
strbuf_commented_addf(&buf, comment_line_char,
|
||||
_(tag_template_nocleanup), tag, comment_line_char);
|
||||
strbuf_commented_addf(&buf, comment_line_str,
|
||||
_(tag_template_nocleanup), tag, comment_line_str);
|
||||
write_or_die(fd, buf.buf, buf.len);
|
||||
strbuf_release(&buf);
|
||||
}
|
||||
@ -347,7 +347,7 @@ static void create_tag(const struct object_id *object, const char *object_ref,
|
||||
|
||||
if (opt->cleanup_mode != CLEANUP_NONE)
|
||||
strbuf_stripspace(buf,
|
||||
opt->cleanup_mode == CLEANUP_ALL ? comment_line_char : '\0');
|
||||
opt->cleanup_mode == CLEANUP_ALL ? comment_line_str : NULL);
|
||||
|
||||
if (!opt->message_given && !buf->len)
|
||||
die(_("no tag message?"));
|
||||
|
Reference in New Issue
Block a user