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

Failure using "svn patch" with Git patch that adds files. Wrong path is used.

From: Konstantin Kolinko <knst.kolinko_at_gmail.com>
Date: Sat, 5 Nov 2011 17:56:43 +0400

Hi!

My colleague uses Git to work on one of Apache projects. He published
a patch, but I have problems trying to apply it cleanly with "svn
patch".

Source code:
https://svn.apache.org/repos/asf/tomcat/trunk@1197793
Patch:
http://people.apache.org/~markt/patches/2011-11-03-redeploy-trunk-v2.patch

The patch is in Git format, with most changes being written with the
following header:
[[[
diff --git a/conf/context.xml b/conf/context.xml
index 745bf95..d9d94af 100644
--- a/conf/context.xml
+++ b/conf/context.xml
]]]

But it also contains an added file:
[[[
diff --git a/java/org/apache/catalina/startup/FailedContext.java
b/java/org/apache/catalina/startup/FailedContext.java
new file mode 100644
index 0000000..63f6544
--- /dev/null
+++ b/java/org/apache/catalina/startup/FailedContext.java
]]]

I am on WindowsXP, using svn, version 1.7.1 (r1186859) compiled Oct 21
2011, 22:59:27

I tried the following:
a) svn patch 2011-11-03-redeploy-trunk-v2.patch

It processed the added file correctly,
but fails to process the modified files.
[[[
Skipped missing target: 'b\conf\context.xml'
...
]]]

b) svn patch --strip 1 2011-11-03-redeploy-trunk-v2.patch

It processes the modified files correctly,
but fails to process the added file:
This creates the following folders in my working copy
dev/null
   - empty
org/apache/catalina/startup
   - with file "FailedContext.java"

The created folders and file are added to version control.

So a workaround is to apply a) followed by b) and then revert the odd
folders and file created by b).

I think that the proper recipe to apply such patch is b) "svn patch --strip 1"
(or maybe add --git option in svn 1.8, or autodetect Git patch format).

I do not understand why "svn patch --strip 1" strips two components
from the path to the added file,
and why it creates "dev/null" in my working copy on Windows.

Note that it is "/dev/null" in the patch, with proper "/" slash at the
beginning, unlike all other paths that do not start with "/".

Best regards,
Konstantin Kolinko
Received on 2011-11-05 14:57:17 CET

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.