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/merge.c | |
parent | 44fe83502edf5391bb3a5997cab01794b4568062 (diff) | |
download | git-eff80a9fd990de3605063050dae32f969ef18ba8.tar.gz |
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/merge.c')
-rw-r--r-- | builtin/merge.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/merge.c b/builtin/merge.c index 3a31c4bc25..d7baa2683c 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -788,17 +788,16 @@ static const char merge_editor_comment[] = N_("Please enter a commit message to explain why this merge is necessary,\n" "especially if it merges an updated upstream into a topic branch.\n" "\n" - "Lines starting with '#' will be ignored, and an empty message aborts\n" + "Lines starting with '%c' will be ignored, and an empty message aborts\n" "the commit.\n"); static void prepare_to_commit(struct commit_list *remoteheads) { struct strbuf msg = STRBUF_INIT; - const char *comment = _(merge_editor_comment); strbuf_addbuf(&msg, &merge_msg); strbuf_addch(&msg, '\n'); if (0 < option_edit) - strbuf_add_lines(&msg, "# ", comment, strlen(comment)); + strbuf_commented_addf(&msg, _(merge_editor_comment), comment_line_char); write_merge_msg(&msg); if (run_hook(get_index_file(), "prepare-commit-msg", git_path("MERGE_MSG"), "merge", NULL, NULL)) |