git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Making a patch: "git format-patch" does not produce the documented format

From
Dale R. Worley <worley@alum.mit.edu>
Date
Jul 31, 2013, 21:31 UTC
Message-ID
<201307312131.r6VLVliK028321@hobgoblin.ariadne.com>

I'm working on writing a patch, but I'm running into a problem. The patch itself is from this commit:

    $ git log -1
    commit 07a25537909dd277426818a39d9bc4235e755383
    Author: Dale Worley <worley@ariadne.com>
    Date:   Thu Jul 18 18:43:12 2013 -0400
	open() returns -1 on failure, and indeed 0 is a possible success value
	if the user closed stdin in our process.  Fix the test.
    $ 
But the output of "git format-patch" is:
    From 07a25537909dd277426818a39d9bc4235e755383 Mon Sep 17 00:00:00 2001
    From: Dale Worley <worley@ariadne.com>
    Date: Thu, 18 Jul 2013 18:43:12 -0400
    Subject: [PATCH] open() returns -1 on failure, and indeed 0 is a possible
     success value if the user closed stdin in our process.  Fix
     the test.
    ---
     t/t0070-fundamental.sh |    7 +++++++
     wrapper.c              |    2 +-
     2 files changed, 8 insertions(+), 1 deletions(-)
    diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
    index 986b2a8..d427f3a 100755
    --- a/t/t0070-fundamental.sh
    +++ b/t/t0070-fundamental.sh
    @@ -25,6 +25,13 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
	    grep "cannotwrite/test" err
    [...]

Notice that the whole commit message has been formatted as if it is part of the Subject line, and the line breaks in the commit message have been refilled.

The file Documentation/SubmittingPatches says that "git format-patch" produces patches in the best format, but the manual page shows an example more like this:

    From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
    From: Tony Luck <tony.luck@intel.com>
    Date: Tue, 13 Jul 2010 11:42:54 -0700
    Subject: [PATCH] Put ia64 config files on the
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    arch/arm config files were slimmed down using a python script
    (See commit c2330e286f68f1c408b4aa6515ba49d57f05beae comment)
    [...]

That is, the first line of the commit message is in the Subject and the remaining lines are in the message body. As far as I can tell, that's what SubmittingPatches prescribes. And that is what I see in the Git mailing list on vger.

(This is with git 1.8.3.3.)

Exactly how should the commit message be inserted into the patch e-mail? What needs to be updated so the code is consistent with the documentation?

Dale
Next: John Keeping
Message 1 of 4 in “Making a patch: "git format-patch" does not produce the documented format”
  1. Dale R. WorleyJul 31, 2013
  2. John KeepingJul 31, 2013
  3. Dale R. WorleyAug 2, 2013
  4. Junio C HamanoAug 2, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.