A Sáb, 10-12-2016 às 14:09 -0800, Junio C Hamano escreveu: > We only update comment_line_char from the default "#" when the > configured value is a single-byte character and we ignore incorrect > values in the configuration file. So I think the patch you sent is > correct after all. I am still not sure what version do we prefer. Check whether core.commentchar is a single character. If not, use '#' as the $comment_line_char. +sub get_comment_line_char { + my $comment_line_char = config("core.commentchar") || '#'; + $comment_line_char = '#' if ($comment_line_char eq 'auto'); + $comment_line_char = '#' if (length($comment_line_char) != 1); + return $comment_line_char; +} Check whether core.commentchar is a single character. If not, use the first character of the core.commentchar value, mirroring the "rebase -i" behavior introduced recently. +sub get_comment_line_char { + my $comment_line_char = config("core.commentchar") || '#'; + $comment_line_char = '#' if ($comment_line_char eq 'auto'); + if (length($comment_line_char) != 1) { + # use first character + $comment_line_char = substr($comment_line_char, 0, 1); + } + return $comment_line_char; +} Or akin to what I had in the first patch related to handling 'auto' value of core.commentchar configuration variable: +sub get_comment_line_char { + my $comment_line_char = config("core.commentchar") || '#'; + $comment_line_char = '#' if ($comment_line_char eq 'auto'); + return $comment_line_char; +} Which assumes that the value of core.commentchar configuration variable is either 'auto' or one single character, or the variable is not defined.