Re: Bug: fatal: patch fragment without header at line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tuxdna <tuxdna@xxxxxxxxx> writes:

> 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 readme

and here comes a paragraph in the log message that can be made more
understandable by having such a patch fragment.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]