{"thread":{"id":"23954","subject":"Using git am -p 2 with binary patches","startedAt":"2010-05-31T15:59:29Z","lastAt":"2010-05-31T15:59:29Z","messageCount":1,"participants":["Pico Geyer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"142616","messageId":"4C03DCE1.2000201@xiplink.com","threadId":"23954","inReplyTo":null,"subject":"Using git am -p 2 with binary patches","fromName":"Pico Geyer","fromEmail":"pico@xiplink.com","sentAt":"2010-05-31T15:59:29Z","receivedAt":"2010-05-31T15:59:29Z","isPatch":false,"sender":{"key":"pico@xiplink.com","avatar":null},"body":"Hi all.\n\nI've been trying to apply a set of patches from one repository to a completely independent repository (no shared history).\nSince the paths are different, I'm applying the patches with git am -p 2\nI noticed that whenever my patches contain binary files, git-am fails to apply the patch.\n\nHere's a simple test case:\nmkdir gittmp\ncd gittmp\ngit init\nmkdir subdir\necho \"abcdefghijklmnop\" > blah.txt\ntar -czf subdir/binfile.tgz blah.txt\ngit add subdir/binfile.tgz\ngit commit -m \"Added binary file\"\ngit format-patch --root HEAD\ngit am -p 2 0001-Added-binary-file.patch\n\nAnd the output that I get is:\nApplying: Added binary file\nfatal: git diff header lacks filename information when removing 2 leading pathname components (line 9)\nPatch failed at 0001 Added binary file\nWhen you have resolved this problem run \"git am --resolved\".\nIf you would prefer to skip this patch, instead run \"git am --skip\".\nTo restore the original branch and stop patching run \"git am --abort\".\n\nIs this a bug in git-am or git-apply?\nOr is there a good reason why this doesn't work?\n\nI'm using the latest git version (1.7.1)\n\nThanks in advance.\nPico\n"}]}