Re: [PATCH 2/3] git-add--interactive: remove hunk coalescing

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/3] git-add--interactive: remove hunk coalescing

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:52

Junio C Hamano [off-list ref] writes:
Blindly concatenating the above two and feeding them to "git apply" *may*
happen to work by accident, not by design.  This very much feels like a
hack of "This works most of the time for me, your mileage may vary" kind,
which we would want to avoid when we can.
Well, I changed my mind.  Let's run with this and see what happens.

The patch application is hunk-by-hunk in nature anyway, and if the user
munges the trailing context of the first half of an originally-single hunk
and the leading context of the latter half in an inconsistent way, we
would notice the problem anyway.

Re: [PATCH 2/3] git-add--interactive: remove hunk coalescing

From: Thomas Rast <hidden>
Date: 2016-06-15 22:44:53

Junio C Hamano wrote:
quoted
Blindly concatenating the above two and feeding them to "git apply" *may*
happen to work by accident, not by design.  This very much feels like a
hack of "This works most of the time for me, your mileage may vary" kind,
which we would want to avoid when we can.
Well, I changed my mind.  Let's run with this and see what happens.
In support of this being a feature of git-apply, notice that it even
handles the situation correctly where the context of a hunk has been
influenced by previous hunks, as in
@@ -1,2 +1,3 @@
 foo
+quux
 bar
@@ -1,3 +1,4 @@
 foo
 quux
+abc
 bar
With Don Zickus' recent patch, it also handles patches that go over
the same file twice.

- Thomas

-- 
Thomas Rast
trast@student.ethz.ch


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help