• Oinks@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    4
    ·
    7 hours ago

    Hooray to underspecified file formats.

    From patch(1):

    patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an email message containing a diff listing to patch, and it should work.

    From git-am(1):

    The patch is expected to be inline, directly following the message. Any line that is of the form:

    • three-dashes and end-of-line, or
    • a line that begins with “diff -”, or
    • a line that begins with "Index: "

    is taken as the beginning of a patch, and the commit log message is terminated before the first occurrence of such a line.

    Ideally git-am should use a better file format, but I suppose the more realistic lesson now is to never have inline diffs in Commit messages.

  • verstra@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    9 hours ago

    Context: this happens if you use patch(1) with patches generated by git format-patch. If you do, you should be using git am instead.