git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-apply quirks
@ 2008-06-10 19:40 Don Zickus
  0 siblings, 0 replies; only message in thread
From: Don Zickus @ 2008-06-10 19:40 UTC (permalink / raw)
  To: git

Hi.

I work with a lot of backporting of patches and there are times when
people combine multiple patches together such that the resulting patch can
have multiple chunks changing the same file.  I have noticed git-apply
does not handle this case correctly.  It usually ignores all previous
chunks and only applies the last one.

The same scenario can also cause git-apply to fail if a later patch chunk
depends on changes from an earlier patch chunk.

The traditional 'patch' command seems to handle the successfully.  Is this
git-apply behaviour intended or is it a bug?

The following example summarizes the problem:

#cd <some git repo>
# cat > dummy << EOF
This is
a
test
of
git-apply
doing
something
incorrectly.

Please
help.

EOF
#git-add dummy
#git commit -m 'test'
#git-apply <attached patch below>

You will notice in the git-diff output the first chunk is ignored and only
the second applies.

Cheers,
Don


diff a/dummy b/dummy
--- a/dummy
+++ b/dummy
@@ -1,5 +1,5 @@
 This is
-a
+the first
 test
 of
 git-apply

diff a/dummy b/dummy
--- a/dummy
+++ b/dummy
@@ -6,6 +6,8 @@ git-apply
 doing
 something
 incorrectly.
+Now here is the
+second test.
 
 Please
 help.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-10 19:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10 19:40 git-apply quirks Don Zickus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).