From: Thomas Rast <trast@student.ethz.ch>
To: Jeff King <peff@peff.net>
Cc: <gitster@pobox.com>, Kirill Smelkov <kirr@mns.spb.ru>,
<git@vger.kernel.org>
Subject: Re: [PATCH] add -p: do not attempt to coalesce mode changes
Date: Sat, 15 Aug 2009 16:35:23 +0200 [thread overview]
Message-ID: <200908151635.24341.trast@student.ethz.ch> (raw)
In-Reply-To: <20090815141710.GA15978@sigill.intra.peff.net>
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
next prev parent reply other threads:[~2009-08-15 14:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-15 12:26 [BUG, PATCH] git add -p: demonstrate failure when staging both mode and hunk Kirill Smelkov
2009-08-15 13:56 ` [PATCH] add -p: do not attempt to coalesce mode changes Thomas Rast
2009-08-15 14:17 ` Jeff King
2009-08-15 14:35 ` Thomas Rast [this message]
2009-08-15 18:19 ` Junio C Hamano
2009-08-18 7:52 ` Kirill Smelkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200908151635.24341.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kirr@mns.spb.ru \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox