Git version: git-1.7.7.6-1.fc16.x86_64 I am getting an error with a patch that I am applying to a git repository. I have created a test case for this issue that I am facing. $ git apply --check 0001-modified-README.patch fatal: patch fragment without header at line 7: @@ -635,9 +635,7 @@ some_function() Clearly line 7 appears to be a patch but it isn't. It is the part of email body or the patch context. To my understanding, the patch should always be identified whenever the patch block starts with a "diff --git", which is line 21 as below: 1 From aa3acc563af0422e6a9f4afc432b7fabdf845d81 Mon Sep 17 00:00:00 2001 2 From: Saleem Ansari <tuxdna@xxxxxxxxx> 3 Date: Mon, 16 Jul 2012 17:42:58 +0530 4 Subject: [PATCH] modified README 5 6 7 @@ -635,9 +635,7 @@ some_function() 8 9 10 - # a comment here 11 + not a comment 12 13 14 15 thats all folks 16 17 --- 18 README | 1 + 19 1 files changed, 1 insertions(+), 0 deletions(-) 20 21 diff --git a/README b/README 22 index ce01362..d294257 100644 23 --- a/README 24 +++ b/README 25 @@ -1 +1,2 @@ 26 hello 27 +this is a readme 28 -- 29 1.7.7.6 30 Apart from changing the patch itself, how else can I work-around this problem? Steps to create and verify the testcase: # Create a temporary directory mkdir /tmp/bug cd /tmp/bug git init . echo "hello" > README git commit -m "Initial commit" # create a test branch for verification later git checkout -b test # make changes into a different branch git checkout -b bugger echo "this is a readme" > README git commit -m "modified README" git format-patch HEAD^ # this will generate 0001-modified-README.patch # Now inside the patch email body add some random patch which should break # or download the attachment ( 0001-modified-README.patch ) /tuxdna
Attachment:
0001-modified-README.patch
Description: Binary data