From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 669D11FC96 for ; Fri, 9 Dec 2016 17:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933872AbcLIRTU (ORCPT ); Fri, 9 Dec 2016 12:19:20 -0500 Received: from relay4.ptmail.sapo.pt ([212.55.154.24]:56197 "EHLO sapo.pt" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933531AbcLIRTT (ORCPT ); Fri, 9 Dec 2016 12:19:19 -0500 Received: (qmail 22010 invoked from network); 9 Dec 2016 17:19:16 -0000 Received: (qmail 23376 invoked from network); 9 Dec 2016 17:19:16 -0000 Received: from unknown (HELO catarina) (vascomalmeida@sapo.pt@[85.246.157.91]) (envelope-sender ) by ptmail-mta-auth01 (qmail-ptmail-1.0.0) with ESMTPA for ; 9 Dec 2016 17:19:16 -0000 X-PTMail-RemoteIP: 85.246.157.91 X-PTMail-AllowedSender-Action: X-PTMail-Service: default Message-ID: <1481303956.4934.8.camel@sapo.pt> Subject: Re: [PATCH v6 01/16] Git.pm: add subroutines for commenting lines From: Vasco Almeida To: Junio C Hamano Cc: git@vger.kernel.org, Jiang Xin , =?ISO-8859-1?Q?=C6var_Arnfj=F6r=F0?= Bjarmason , =?ISO-8859-1?Q?Jean-No=EBl?= AVILA , Jakub =?UTF-8?Q?Nar=C4=99bski?= , David Aguilar Date: Fri, 09 Dec 2016 16:19:16 -0100 In-Reply-To: References: <20161111124541.8216-1-vascomalmeida@sapo.pt> <20161111124541.8216-2-vascomalmeida@sapo.pt> <1479823833.1956.7.camel@sapo.pt> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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(__ <