On Mon, 16 Nov 2009, Stefan Sperling wrote:
> 5) Hunks are only applied if they do not overlap with any other hunk.
Other patch implementations are able to deal with overlapping hunks.
For example, consider this pair of hunks on the left, and a
corresponding single hunk on the right:
@@ -1,5 +1,5 @@ @@ -1,9 +1,9 @@
one one
two two
-three -three
+3 +3
four four
five five
@@ -5,5 +5,5 @@ six
five -seven
six +7
-seven eight
+7 nine
eight
nine
Even though line 5 appears in both hunks on the left, I think the
intent is clear. I think that the only difference between the left
hand pair of hunks and the right hand single hunk is that, with
the pair of hunks, it should be possible for one hunk to fail while
the other succeeds, but with a single hunk there is no possibility
of partial success.
An interactive patch assistant or conflict resolution tool might
want to offer the option of splitting a hunk into two or more
smaller hunks and re-trying each smaller hunk. "git add --patch"
offers something like this in a different context (getting ready
to commit a subset of the changes to a file).
--apb (Alan Barrett)