From: Vasco Almeida Date: Fri, 09 Dec 2016 17:19:16 GMT Subject: Re: [PATCH v6 01/16] Git.pm: add subroutines for commenting lines Message-ID: <1481303956.4934.8.camel@sapo.pt> In-Reply-To: A Ter, 22-11-2016 às 09:42 -0800, Junio C Hamano escreveu: > The incremental update below looks sensible.  We'd also want to > protect this codepath from a misconfigured two-or-more byte sequence > in core.commentchar, I would suspect, to be consistent. Are the below changes alright for what you propose? It just checks if the length of core.commentchar's value is 1, otherwise use '#' as the comment_line_char. As a note, when I set core.commentchar with "git config core.commentChar 'batata'", I get the following error message when I issue "git add -i": error: core.commentChar should only be one character fatal: bad config variable 'core.commentchar' in file '.git/config' at line 6 -- >8 -- diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 3a6d846..4e0ab5a 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -1072,7 +1072,7 @@ sub edit_hunk_manually {   print $fh @$oldtext;   my $is_reverse = $patch_mode_flavour{IS_REVERSE};   my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-'); - my $comment_line_char = Git::config("core.commentchar") || '#'; + my $comment_line_char = Git::get_comment_line_char;   print $fh Git::comment_lines sprintf(__ <