drecute
drecute

Reputation: 758

How do I apply a patch that contains a file that doesn't exist?

I'm applying a patch to an svn working copy. In the patch file contains a new file.

Patch would normally return something like this:

can't find file to patch at input line 344
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java b/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java
|new file mode 100644
|index 0000000..c10b3ae
|--- /dev/null
|+++ b/user-features/src/main/java/com/yookos/util/SearchRelevanceHelper.java
--------------------------
File to patch:

How do I handle this?

Upvotes: 1

Views: 2490

Answers (1)

Shengis
Shengis

Reputation: 176

I tried your patch with the cygwin patch command.

afusilde@LFR408288 ~/testdir
$ cat newpatch
diff --git a/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java b/user-features/src/main/java/com/app2/util/SearchRelevanceHelper.java
new file mode 100644
index 0000000..c10b3ae
--- /dev/null
+++ b/user-features/src/main/java/com/yookos/util/SearchRelevanceHelper.java

afusilde@LFR408288 ~/testdir
$ mkdir test

afusilde@LFR408288 ~/testdir
$ cd test

afusilde@LFR408288 ~/testdir/test
$ patch < ../newpatch
patching file SearchRelevanceHelper.java

afusilde@LFR408288 ~/testdir/test
$ ls
SearchRelevanceHelper.java

No problem for me. Do you use a GNU patch command ?

Upvotes: 1

Related Questions