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

Re: [PATCH] cherry-pick: Append -x line on separate paragraph

From
Jeff King <peff@peff.net>
Date
Sep 10, 2012, 16:27 UTC
Message-ID
<20120910162754.GD9435@sigill.intra.peff.net>
In-Reply-To
<1498324622.1357.1347113459304.JavaMail.root@bazinga.schuettel.ch>
On Sat, Sep 08, 2012 at 04:10:59PM +0200, Robin Stocker wrote:
Show 9 quoted lines
> > > Maybe the solution is to detect if the original commit message
> > > ends with a trailer and in that case keep the existing behavior
> > > of not inserting a blank line?
> > 
> > Yeah, that sounds like a good change from "this makes the result
> > look better" point of view.
> 
> How do you think we could best detect a tailer? Check if all
> lines of the last paragraph start with /[\w-]+: /?

There is ends_rfc2822_footer() in builtin/commit.c, which is currently used for adding Signed-off-by lines. It might make sense to factor that out, and have a new:

  add_pseudoheader(struct strbuf *commit_message,
                   const char *header)

that would implement the same set of spacing rules for signed-off-by, cherry-picked-from, and anything else we end up adding later.

I think pseudo-headers like these might also want duplicate suppression of the final line, which could be part of that function. Note that you would not want to suppress a duplicate line from the middle of the trailer, since you might want to sign-off twice (e.g., you sign-off the original, and then also the cherry-pick). But you would not want two duplicate lines at the end saying "Signed-off-by: ...", and I believe "git commit" already suppresses those duplicates.

> I'm going to work on this and submit a new version of the patch. The
> "Cherry-picked-from" change could then be made later on top of that.

Yay. This has come up more than once over the years, so I am glad to see somebody working on it.

-Peff
Previous: Robin Stocker
Message 6 of 6 in “cherry-pick: Append -x line on separate paragraph”
  1. cherry-pick: Append -x line on separate paragraphRobin Stocker, Sep 4, 2012
  2. Junio C HamanoSep 4, 2012
  3. Robin StockerSep 5, 2012
  4. Junio C HamanoSep 6, 2012
  5. Robin StockerSep 8, 2012
  6. Jeff KingSep 10, 2012

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.