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

More builtin git-am issues..

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Sep 4, 2015, 23:47 UTC
Message-ID
<CA+55aFzN4SnenchxPScn61_apzitGAPtoYEd49iLZPxgK0KQGw@mail.gmail.com>

Ok, this may not be new either, but I'm trying to be careful when using "git am" these days, because I know it got rewritten.

And I _think_ the whitespace handling for adding sign-offs got scrogged.

I just applied the usual patch-bomb from Andrew, and several of the commits (but not all) end up looking like this:

    Cc: <stable@vger.kernel.org> [3.15+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
note the extraneous whitespace line between Andrew's sign-off and mine.

What's odd is that the emails I'm applying literally don't have that extra empty line, so it's git that somehow decides to add it. Only for a few cases, though.

The pattern *seems* to be that git now looks at the *first* line of the sign-off block and decides that "this is a sign-off block if that first line has a sign-ff on it, ie this is fine:

    Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Pavel Emelyanov <xemul@parallels.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
but the failing cases have a comment by Andrew:
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
    Cc: Xishi Qiu <qiuxishi@huawei.com>
    Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
    Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>
    Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: David Rientjes <rientjes@google.com>
    Cc: <stable@vger.kernel.org>        [4.2.x]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

ie that "[akpm@linux-foundation.org: coding-style fixes]" makes git am now decide that the previous block of text was not a sign-off block, so it adds an empty line before adding my sign-off. But very obviously it *was* a sign-off block.

Maybe this isn't new at all, and it's just that I notice because I'm looking for "git am" oddities. Something is clearly wrong in "has_conforming_footer()".

I *think* it's this part:
                if (!(found_rfc2822 ||
                      is_cherry_picked_from_line(buf + i, k - i - 1)))
                        return 0;

which basically returns 0 for _any_ line in the footer that doesn't match the found_rfc2822 format.

I really think that if we find any "Signed-off-by:" in that last chunk, we should not add a whitespace.

Comments?
                    Linus
Next: Linus Torvalds
Message 1 of 30 in “More builtin git-am issues..”
  1. Linus TorvaldsSep 4, 2015
  2. Linus TorvaldsSep 4, 2015
  3. Jeff KingSep 5, 2015
  4. Linus TorvaldsSep 5, 2015
  5. Junio C HamanoSep 5, 2015
  6. Linus TorvaldsSep 5, 2015
  7. Junio C HamanoSep 5, 2015
  8. Linus TorvaldsSep 5, 2015
  9. Junio C HamanoSep 5, 2015
  10. Johannes SixtSep 5, 2015
  11. Jeff KingSep 5, 2015
  12. Junio C HamanoSep 5, 2015
  13. Junio C HamanoSep 5, 2015
  14. Junio C HamanoSep 5, 2015
  15. Junio C HamanoSep 5, 2015
  16. Christian CouderSep 7, 2015
  17. Junio C HamanoSep 5, 2015
  18. Junio C HamanoSep 5, 2015
  19. Junio C HamanoSep 5, 2015
  20. Linus TorvaldsSep 5, 2015
  21. Junio C HamanoSep 5, 2015
  22. am: match --signoff to the original scripted versionJunio C Hamano, Sep 6, 2015
  23. Paul TanSep 6, 2015
  24. Junio C HamanoSep 6, 2015
  25. Jeff KingSep 8, 2015
  26. Paul TanSep 6, 2015
  27. Junio C HamanoSep 6, 2015
  28. Linus TorvaldsSep 6, 2015
  29. Jeff KingSep 8, 2015
  30. Junio C HamanoSep 8, 2015

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.