Adding an issue for an existing XFail test...
svn patch tolerates bad git headers:
trunk@1070925>git --version
git version 1.7.4.msysgit.0
trunk@1070925>svn --version
svn, version 1.7.0 (dev build)
compiled Feb 14 2011, 09:09:31
Starting with an unmodified WC, make a simple text change:
trunk@1070925>svn st -v
1 1 jrandom .
1 1 jrandom A
1 1 jrandom A\mu
1 1 jrandom A\B
1 1 jrandom A\B\lambda
1 1 jrandom A\B\E
1 1 jrandom A\B\E\alpha
1 1 jrandom A\B\E\beta
1 1 jrandom A\B\F
1 1 jrandom A\C
1 1 jrandom A\D
1 1 jrandom A\D\gamma
1 1 jrandom A\D\G
1 1 jrandom A\D\G\rho
1 1 jrandom A\D\G\pi
1 1 jrandom A\D\G\tau
1 1 jrandom A\D\H
1 1 jrandom A\D\H\chi
1 1 jrandom A\D\H\omega
1 1 jrandom A\D\H\psi
1 1 jrandom iota
trunk@1070925>echo an edit> iota
Create a git extended diff format patch file using the new --git option:
trunk@1070925>svn diff --git > unidiff.git.extended.diff
trunk@1070925>type unidiff.git.extended.diff
Index: iota
===================================================================
diff --git a/iota b/iota
--- a/iota (revision 1)
+++ b/iota (working copy)
@@ -1 +1 @@
-This is the file 'iota'.
+an edit
Revert the change so we can apply the patch:
trunk@1070925>svn revert -R .
Reverted 'iota'
Note that we can apply the patch with 'svn patch' or git:
trunk@1070925>svn patch unidiff.git.extended.bad.header.diff .
U iota
trunk@1070925>svn diff
Index: iota
===================================================================
--- iota (revision 1)
+++ iota (working copy)
@@ -1 +1 @@
-This is the file 'iota'.
+an edit
trunk@1070925>svn revert -R .
Reverted 'iota'
trunk@1070925>git apply --check --summary --stat --apply unidiff.git.extended.diff
unidiff.git.extended.diff:8: trailing whitespace.
an edit
iota | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
warning: 1 line adds whitespace errors.
trunk@1070925>svn diff
Index: iota
===================================================================
--- iota (revision 1)
+++ iota (working copy)
@@ -1 +1 @@
-This is the file 'iota'.
+an edit
trunk@1070925>svn revert -R .
Reverted 'iota'
Now edit the git patch so it have invalid noise in the header:
trunk@1070925>type unidiff.git.extended.bad.header.diff
Index: iota
===================================================================
diff --git a/iota b/iota
THIS LINE CREATES AN INVALID HEADER
--- a/iota (revision 1)
+++ b/iota (working copy)
@@ -1 +1 @@
-This is the file 'iota'.
+an edit
git rejects this patch:
trunk@1070925>git apply --check --summary --stat --apply
unidiff.git.extended.bad.header.diff
unidiff.git.extended.bad.header.diff:10: trailing whitespace.
an edit
error: patch failed: iota:1
error: iota: patch does not apply
trunk@1070925>svn st -q
But svn patch applies it:
trunk@1070925>svn patch unidiff.git.extended.bad.header.diff .
U iota
trunk@1070925>svn diff
Index: iota
===================================================================
--- iota (revision 1)
+++ iota (working copy)
@@ -1 +1 @@
-This is the file 'iota'.
+an edit
This issue is tested in the C test parse-diff-test.exe 4 'test badly formatted
git diff headers'. See http://svn.apache.org/viewvc?view=revision&revision=960833.