[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Git Patch fails to apply with Svn Patch

From: Eric Berge <ericmberge_at_gmail.com>
Date: Thu, 1 May 2014 14:30:33 -0500

I was running "svn patch" with a patch I created with "git diff" and it
failed to apply, however it applies just fine with the default "patch"
command on my Rhel 6.5 system.

This is due to the "extended header" information that git puts before the
actual diff in some cases. I validated this by removing the lines
beginning with "old mode" and "new mode" in the patch below (file "PATCH2")
and then "svn patch" applied the patch successfully.

I'd like to request that "svn patch" be able to ignore this extended header
information and be able to apply the patch successfully without getting the
"skipping missing target" error. I guess there's an argument that some of
this extended header info should be processed by "svn patch" but for, for
my purposes, it would be enough that it ignored it and applied the rest of
the patch.

Here's an example (in this case the extended header is describing a chmod
change to the target file, indicated by the "old mode" and "new mode"
lines):

*$ cat PATCH2*
*diff --git a/Makefile b/Makefile*
*old mode 100644*
*new mode 100755*
*index caef0a5..310e8e9*
*--- a/Makefile*
*+++ b/Makefile*
*@@ -5,6 +5,7 @@ export BUILD_SYS_ROOT*
* export BUILD_TARGET_ROOT*
* export BUILD_DIR*
* export CMAKE_PASSTHROUGH_ARGS*
*+export ADD_FAKE_VARIABLE*
* export DESTDIR*
* export DISTPKG_LOC*
* export WITH_MOVER*
*$ svn patch PATCH2*
*Skipped missing target: 'b/Makefile'*
*Summary of conflicts:*
* Skipped paths: 1*
*$ patch -p1 < PATCH2*
*patching file Makefile*
*$ svn diff*
*Index: Makefile*
*===================================================================*
*--- Makefile (revision 42326)*
*+++ Makefile (working copy)*
*@@ -5,6 +5,7 @@*
* export BUILD_TARGET_ROOT*
* export BUILD_DIR*
* export CMAKE_PASSTHROUGH_ARGS*
*+export ADD_FAKE_VARIABLE*
* export DESTDIR*
* export DISTPKG_LOC*
* export WITH_MOVER*

Thanks for your consideration of this request,

Eric Berge
Senior File System Developer, StorNext File System
Quantum Corporation
eric.berge_at_quantum.com

P.S. Just for your reference, if you're curious about what the full set of
"extended header" info git generates, the following is from the git-diff
man page from the version (1.8.2.1) running on my system:

               old mode <mode>
               new mode <mode>
               deleted file mode <mode>
               new file mode <mode>
               copy from <path>
               copy to <path>
               rename from <path>
               rename to <path>
               similarity index <number>
               dissimilarity index <number>
               index <hash>..<hash> <mode>
Received on 2014-05-02 07:23:09 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.