diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-01-16 20:18:48 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-16 12:48:22 -0800 |
commit | eff80a9fd990de3605063050dae32f969ef18ba8 (patch) | |
tree | 6a7b0c000cea480ac8e2714cbbf92691b7237b55 /builtin/branch.c | |
parent | 44fe83502edf5391bb3a5997cab01794b4568062 (diff) | |
download | git-eff80a9fd990de3605063050dae32f969ef18ba8.tar.gz git-eff80a9fd990de3605063050dae32f969ef18ba8.tar.xz |
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>
Diffstat (limited to 'builtin/branch.c')
-rw-r--r-- | builtin/branch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/branch.c b/builtin/branch.c index 873f624d1..3548271c4 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -706,11 +706,11 @@ static int edit_branch_description(const char *branch_name) read_branch_desc(&buf, branch_name); if (!buf.len || buf.buf[buf.len-1] != '\n') strbuf_addch(&buf, '\n'); - strbuf_addf(&buf, - "# Please edit the description for the branch\n" - "# %s\n" - "# Lines starting with '#' will be stripped.\n", - branch_name); + strbuf_commented_addf(&buf, + "Please edit the description for the branch\n" + " %s\n" + "Lines starting with '%c' will be stripped.\n", + branch_name, comment_line_char); fp = fopen(git_path(edit_description), "w"); if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) { strbuf_release(&buf); |