----- Original Message ----- From: Ken Tanzer
To: git-users@googlegroups.com
Sent: Sunday, November 10, 2013 8:49 AM
Subject: [git-users] git am "patch does not apply" on removed file

Hello. I have some patches I was having problems with, and have boiled down a simple example. If I try to remove certain files, the patch does not apply. In this case, I'm specifically trying to delete an older version of jquery-ui (jquery-ui-1.8.custom.min.js). I can delete other files, both text and binary, with the commands below, but it fails on this file. Am I doing something wrong or missing something? I get the same problem on git 1.7.1 and Any help appreciated. Thanks.


p.s.,  I've also attached the patch file that was created.

git clone git://git.code.sf.net/p/agency/code agency-code # it is only 10M

cd agency-code
md5sum jquery-ui-1.8.custom.min.js
--> 6e7569e2fed16a02a6be092ef4e4d756  jquery-ui-1.8.custom.min.js
git rm jquery-ui-1.8.custom.min.js
git commit
md5sum jquery-ui-1.8.custom.min.js
--> md5sum: jquery-ui-1.8.custom.min.js: No such file or directory
git format-patch HEAD~1
git reset --hard HEAD~1
md5sum jquery-ui-1.8.custom.min.js
--> 6e7569e2fed16a02a6be092ef4e4d756  jquery-ui-1.8.custom.min.js
git am 0001*

--> Applying: Test deleting jquery file.
error: patch failed: jquery-ui-1.8.custom.min.js:1
error: jquery-ui-1.8.custom.min.js: patch does not apply
Patch failed at 0001 Test deleting jquery file.
The copy of the patch that failed is found in:
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
<Patch extract>
diff --git a/jquery-ui-1.8.custom.min.js b/jquery-ui-1.8.custom.min.js
deleted file mode 100644
index 65966b0..0000000
--- a/jquery-ui-1.8.custom.min.js
+++ /dev/null
@@ -1,374 +0,0 @@
</Patch extract>

Some bikeshedding.

There was a discussion recently on the deveolpers list regarding merging a file deletion where the point was made that a diff simply removes lines, rather than 'deleting a file'. while that wasn't your case it probably has some relevance.

Is this on a Linux system or a Windows system, and what OS / Git versions are you using?

Some things to look at / consider:
1: The diff is relative to dev/null rather than the same file which may confuse some OS's - should it / is it (the OS) try renaming the file. [I'd expect that this was a solved problem but its my first thought]

2: the result of the application is an empty file. What does the OS do - write an empty file, or delete the file?

3: Your error message is "failed at 0001 Test deleting jquery file" which suggest that the permissions are not in the patches favour and the deletion got rejected. What are it's permissions? Does the process have sufficient permission to d the deletions?


You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to