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

Reply via email to