Re: Bug: fatal: patch fragment without header at line
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 16, 2012, 17:19 UTC
- Message-ID
- <7vy5mj39ow.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAK5QfLMs6CMCTtZ3woQfMim1ssYLKEURAMv8+FgqrKJ7otNcnw@mail.gmail.com>
tuxdna <tuxdna@gmail.com> writes:
Show 11 quoted lines
> 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.
Yes, but the error detection needs to stay for a more common case in which the user corrupted the patch by breaking or removing the diff header.
If you want to quote a patch fragment in your log message, it is common to indent the part (without removing the "diff" header) which also has the benefit of making it stand out in the textual description, e.g. here is a sample patch fragment
diff --git a/README b/README
index ce01362..d294257 100644
--- a/README
+++ b/README
@@ -1 +1,2 @@
hello
+this is a readmeand here comes a paragraph in the log message that can be made more understandable by having such a patch fragment.