bug-patch
[Top][All Lists]
Advanced

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

Re: [bug-patch] [PATCH] Add another git-style diff concatenation regress


From: Dmitry V. Levin
Subject: Re: [bug-patch] [PATCH] Add another git-style diff concatenation regression test
Date: Tue, 7 Aug 2012 17:23:07 +0400

On Tue, Aug 07, 2012 at 01:24:13PM +0200, Andreas Grünbacher wrote:
> Dmitry,
> 
> 2012/8/7 Dmitry V. Levin <address@hidden>:
> > * tests/concat-git-diff: Add a test case for erroneous file truncation.
> 
> there are no index lines in this test case, which would tell patch
> that this is not a single git diff but two concatenated git diffs. You
> can only end up with such diffs by hand editing.

Of course re-adding index lines produces the same result.
Here is the 2nd edition where these index lines are not omitted:

diff --git a/tests/concat-git-diff b/tests/concat-git-diff
index 445fd97..52d3004 100644
--- a/tests/concat-git-diff
+++ b/tests/concat-git-diff
@@ -45,3 +45,43 @@ EOF
 check 'cat f' <<EOF
 three
 EOF
+
+cat > f <<EOF
+1
+2
+3
+EOF
+
+cat > concat2.diff <<EOF
+diff --git a/f b/f
+index 01e79c3..0d0b976 100644
+--- a/f
++++ b/f
+@@ -1,3 +1,4 @@
+ 1
+ 2
+ 3
++b
+diff --git a/f b/f
+index 0d0b976..6b2348d 100644
+--- a/f
++++ b/f
+@@ -1,3 +1,4 @@
++a
+ 1
+ 2
+ 3
+EOF
+
+check 'patch -p1 < concat2.diff || echo "Status: $?"' <<EOF
+patching file f
+patching file f
+EOF
+
+check 'cat f' <<EOF
+a
+1
+2
+3
+b
+EOF

> Is this test case based on an actual problem with a patch, or is it made up?

This test case is a heavily reduced real case scenario where the target file
was erroneously truncated:
http://git.altlinux.org/people/vitty/packages/?p=krb5.git;a=blob;f=krb5-1.10.2-fedora-keytab-etype.patch


-- 
ldv

Attachment: pgpp9UFT1UQSa.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]