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

Re: [PATCH 0/2] git-am: add --message-id/--no-message-id options

From
Christian Couder <christian.couder@gmail.com>
Date
Nov 25, 2014, 21:21 UTC
Message-ID
<CAP8UFD0WcSM4NP8XHQe5pg0bwC5-C19OdcNoPWFFz7Ngrfbg8g@mail.gmail.com>
In-Reply-To
<5474B5EE.1030406@redhat.com>
On Tue, Nov 25, 2014 at 6:01 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
Show 28 quoted lines
>
>
> On 25/11/2014 17:27, Christian Couder wrote:
>>> > From: Paolo Bonzini <pbonzini@redhat.com>
>>> >
>>> > This series adds a --message-id option to git-mailinfo and git-am.
>>> > git-am also gets an am.messageid configuration key to set the default,
>>> > and a --no-message-id option to override the configuration key.
>>> > (I'm not sure of the usefulness of a mailinfo.messageid option, so
>>> > I left it out; this follows the example of -k instead of --scissors).
>>> >
>>> > This option can be useful in order to associate commit messages with
>>> > mailing list discussions.
>>> >
>>> > If both --message-id and -s are specified, the Signed-off-by goes
>>> > last.  This is coming out more or less naturally out of the git-am
>>> > implementation, but is also tested in t4150-am.sh.
>> Did you have a look at git interpret-trailers currently in master?
>
> Hmm, now I have.
>
> As far as I understand, all the git-am hooks are called on the commit
> rather than the incoming email: all headers are lost by the time
> git-mailinfo exits, including the Message-Id.  And you cannot call any
> hook before git-mailinfo because git-mailinfo is where the
> Content-Transfer-Encoding is processed.
>
> How would you integrate git-interpret-trailers in git-mailinfo?

I don't know exactly, but people may want to add trailers when they run git-am, see:

http://thread.gmane.org/gmane.comp.version-control.git/251412/

and we decided that it was better to let something like git interpret-trailers decide how they should be handled.

Maybe if git-interpret-trailers could be called from git-mailinfo with some arguments coming from git-am, it could be configured with something like:

git config trailer.Message-Id.command 'perl -ne '\''print $1 if m/^Message-Id: (.*)$/'\'' $ARG'

So "git am --trailer 'Message-Id: msg-file' msg-file" would call "git mailinfo ..." that would call "git interpret-trailers --trailer 'Message-Id: msg-file'" that would call "perl -ne 'print $1 if m/^Message-Id: (.*)$/' msg-file" and the output of this command, let's call it $id, would be put into a "Message-Id: $id" trailer in the commit message.

This way there is nothing specific to Message-Id in the code and people can decide using other trailer.Message-Id.* config variables exactly where the Message-Id trailer would be in the commit message.

Best, Christian.

Previous: Paolo BonziniNext: Paolo Bonzini
Message 8 of 13 in “git-am: add --message-id/--no-message-id options”
  1. 0/2 git-am: add --message-id/--no-message-id optionsPaolo Bonzini, Nov 25, 2014
  2. 1/2 git-mailinfo: add --message-idPaolo Bonzini, Nov 25, 2014
  3. 2/2 git-am: add --message-id/--no-message-idPaolo Bonzini, Nov 25, 2014
  4. Junio C HamanoNov 25, 2014
  5. Paolo BonziniNov 26, 2014
  6. Christian CouderNov 25, 2014
  7. Paolo BonziniNov 25, 2014
  8. Christian CouderNov 25, 2014
  9. Paolo BonziniNov 26, 2014
  10. Christian CouderNov 27, 2014
  11. Junio C HamanoNov 25, 2014
  12. Paolo BonziniNov 25, 2014
  13. Junio C HamanoNov 25, 2014

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.