Re: [PATCH v6 01/16] Git.pm: add subroutines for commenting lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vasco Almeida <vascomalmeida@xxxxxxx> writes:

> A Sex, 11-11-2016 às 11:45 -0100, Vasco Almeida escreveu:
>> +=item comment_lines ( STRING [, STRING... ])
>> +
>> +Comments lines following core.commentchar configuration.
>> +
>> +=cut
>> +
>> +sub comment_lines {
>> +       my $comment_line_char = config("core.commentchar") || '#';
>> +       return prefix_lines("$comment_line_char ", @_);
>> +}
>> +
>
> In light of the recent "Fix problems with rebase -i when
> core.commentchar is defined" [1], I realized that this patch does not
> handle the 'auto' value of core.commentchat configuration variable.
>
> I propose to do the patch below in the next re-roll.
>
> [1] http://www.mail-archive.com/git@xxxxxxxxxxxxxxx/msg107818.html

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.

> -- >8 --
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index 3a6d846..8d33634 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -1073,6 +1073,7 @@ sub edit_hunk_manually {
>  	my $is_reverse = $patch_mode_flavour{IS_REVERSE};
>  	my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');
>  	my $comment_line_char = Git::config("core.commentchar") || '#';
> +	$comment_line_char = '#' if ($comment_line_char eq 'auto');
>  	print $fh Git::comment_lines sprintf(__ <<EOF, $remove_minus, $remove_plus, $comment_line_char),
>  ---
>  To remove '%s' lines, make them ' ' lines (context).
> diff --git a/perl/Git.pm b/perl/Git.pm
> index 69cd1dd..47b5899 100644
> --- a/perl/Git.pm
> +++ b/perl/Git.pm
> @@ -1459,6 +1459,7 @@ Comments lines following core.commentchar configuration.
>  
>  sub comment_lines {
>  	my $comment_line_char = config("core.commentchar") || '#';
> +	$comment_line_char = '#' if ($comment_line_char eq 'auto');
>  	return prefix_lines("$comment_line_char ", @_);
>  }




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]