Re: [PATCH] add -p: do not attempt to coalesce mode changes

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

 



Jeff King wrote:
> 
> > --- a/git-add--interactive.perl
> > +++ b/git-add--interactive.perl
> > @@ -841,6 +841,10 @@
> >  	my ($last_o_ctx, $last_was_dirty);
> >  
> >  	for (grep { $_->{USE} } @in) {
> > +		if ($_->{TYPE} ne 'hunk') {
> > +			push @out, $_;
> > +			next;
> > +		}
> >  		my $text = $_->{TEXT};
> >  		my ($o_ofs) = parse_hunk_header($text->[0]);
> >  		if (defined $last_o_ctx &&
> 
> Hmm. I am not too familiar with the coalesce_overlapping_hunks code, but
> it looks like we peek at $out[-1] based on $last_o_ctx, assuming that
> $last_o_ctx comes from the last hunk pushed (either because we just
> pushed it, or we merged into it).  So a non-hunk in the middle of some
> coalescing hunks is going to violate that assumption.
> 
> As it is now, I think we always put the 'mode' hunk at the very
> beginning, so that shouldn't happen (and IIRC, that order is preserved
> throughout). So maybe it is not worth worrying about. But an alternate
> patch is below.

Hmm.  I briefly considered worrying about futureproofing, but then
decided it wasn't worth it since we also rely on
coalesce_overlapping_hunks only being run over the hunks of a single
file.  But since you already went to the lengths of doing it, feel
free to take the explanation in my commit message and add my Acked-by
:-)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]