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

Re: git cherry-pick -x: missing blank line before the "cherry picked from commit" line

From
Christian Couder <christian.couder@gmail.com>
Date
Dec 5, 2022, 12:56 UTC
Message-ID
<CAP8UFD1G++GvNxCVdwDqSm4P3SseyOWNh2jKBZ4jm-OTn2Vsmg@mail.gmail.com>
In-Reply-To
<20221204154927.GF33204@zira.vinc17.org>
On Sun, Dec 4, 2022 at 4:49 PM Vincent Lefevre <vincent@vinc17.net> wrote:
Show 14 quoted lines
>
> On 2022-12-04 15:13:52 +0000, Phillip Wood wrote:
> > On 02/12/2022 17:01, Vincent Lefevre wrote:
> > > First, one issue is that this is not documented (I was not aware of
> > > the notion of trailers, well, at least concerning a special handling
> > > by Git).
> >
> > They are mentioned in the documentation for 'git commit' see the --signoff
> > and --trailer options. The main reference is 'git interpret-trailers'
>
> This issue occurs with "git cherry-pick -x", so that one could expect
> documentation there. Since I don't use trailers (this was a false
> positive), I wouldn't have the idea to look at the --trailer
> documentation.

Yeah, the documentation for the -x option on the git cherry-pick page should probably say that the added line will be put at the end of the trailer part of the commit message and perhaps link to the git commit or git interpret-trailers page. Patch welcome!

Show 14 quoted lines
> > > Then perhaps there should be some configuration to define which
> > > tokens are allowed (or forbidden) for trailers. For instance,
> > > I would say that "Note" is too common in log messages to be
> > > regarded as a trailer token.
> >
> > There are some safeguards when looking for trailers (see the
> > interpret-trailers man page) I think you have been unlucky here, I don't
> > remember this being reported before. I've cc'd Christian who knows more
> > about trailers than I do to see if he has anything to add.
>
> I think that what could be interesting there is a
> trailer.<token>.separators option (assuming that one can
> use an empty list of separators to disable a token), but
> that doesn't exist.

There is the trailer.separators config option. I am not sure if it disables trailers completely though if it is empty. If it doesn't, that could be an interesting feature to implement for people who don't use trailers at all (except for lines added by cherry-pick).

A trailer.<token>.separators option that disables some <token> when empty could be another interesting idea, but it might have drawbacks. For example you might disable the "note" token, but then find that people sometimes use "notes:" or "NB:" or "PS:" or other things like that at the end of their commit messages.

Previous: Vincent LefevreNext: Vincent Lefevre
Message 6 of 7 in “git cherry-pick -x: missing blank line before the "cherry picked from commit" line”
  1. Vincent LefevreDec 2, 2022
  2. Phillip WoodDec 2, 2022
  3. Vincent LefevreDec 2, 2022
  4. Phillip WoodDec 4, 2022
  5. Vincent LefevreDec 4, 2022
  6. Christian CouderDec 5, 2022
  7. Vincent LefevreDec 16, 2022

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.