commit: allow core.commentChar=auto for character auto selection

When core.commentChar is "auto", the comment char starts with '#' as
in default but if it's already in the prepared message, find another
char in a small subset. This should stop surprises because git strips
some lines unexpectedly.

Note that git is not smart enough to recognize '#' as the comment char
in custom templates and convert it if the final comment char is
different. It thinks '#' lines in custom templates as part of the
commit message. So don't use this with custom templates.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2014-05-17 08:52:23 +07:00
committed by Junio C Hamano
parent 50b54fd72a
commit 84c9dc2c5a
6 changed files with 66 additions and 0 deletions

View File

@ -602,6 +602,7 @@ extern int precomposed_unicode;
* that is subject to stripspace.
*/
extern char comment_line_char;
extern int auto_comment_line_char;
enum branch_track {
BRANCH_TRACK_UNSPECIFIED = -1,