Allow custom "comment char"
Some users do want to write a line that begin with a pound sign, #,
in their commit log message. Many tracking system recognise
a token of #<bugid> form, for example.
The support we offer these use cases is not very friendly to the end
users. They have a choice between
- Don't do it. Avoid such a line by rewrapping or indenting; and
- Use --cleanup=whitespace but remove all the hint lines we add.
Give them a way to set a custom comment char, e.g.
$ git -c core.commentchar="%" commit
so that they do not have to do either of the two workarounds.
[jc: although I started the topic, all the tests and documentation
updates, many of the call sites of the new strbuf_add_commented_*()
functions, and the change to git-submodule.sh scripted Porcelain are
from Ralf.]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
10
wt-status.c
10
wt-status.c
@ -45,7 +45,7 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,
|
||||
|
||||
strbuf_vaddf(&sb, fmt, ap);
|
||||
if (!sb.len) {
|
||||
strbuf_addch(&sb, '#');
|
||||
strbuf_addch(&sb, comment_line_char);
|
||||
if (!trail)
|
||||
strbuf_addch(&sb, ' ');
|
||||
color_print_strbuf(s->fp, color, &sb);
|
||||
@ -59,7 +59,7 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,
|
||||
|
||||
strbuf_reset(&linebuf);
|
||||
if (at_bol) {
|
||||
strbuf_addch(&linebuf, '#');
|
||||
strbuf_addch(&linebuf, comment_line_char);
|
||||
if (*line != '\n' && *line != '\t')
|
||||
strbuf_addch(&linebuf, ' ');
|
||||
}
|
||||
@ -760,8 +760,10 @@ static void wt_status_print_tracking(struct wt_status *s)
|
||||
|
||||
for (cp = sb.buf; (ep = strchr(cp, '\n')) != NULL; cp = ep + 1)
|
||||
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s),
|
||||
"# %.*s", (int)(ep - cp), cp);
|
||||
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
|
||||
"%c %.*s", comment_line_char,
|
||||
(int)(ep - cp), cp);
|
||||
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "%c",
|
||||
comment_line_char);
|
||||
}
|
||||
|
||||
static int has_unmerged(struct wt_status *s)
|
||||
|
||||
Reference in New Issue
Block a user