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

Re: [PATCH v9 11/11] Documentation: add documentation for 'git interpret-trailers'

From
Christian Couder <christian.couder@gmail.com>
Date
Apr 2, 2014, 06:01 UTC
Message-ID
<CAP8UFD1hrXDdwKokLH_j=vwWoViC9sSJHf0gTFubh-oFQao4MA@mail.gmail.com>
In-Reply-To
<20140402003938.GE6851@google.com>
Hi,
On Wed, Apr 2, 2014 at 2:39 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 14 quoted lines
> (culling cc list)
> Hi,
>
> Christian Couder wrote:
>
>> [Subject: Documentation: add documentation for 'git interpret-trailers']
>>
>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>
> This should be squashed into the patch that introduces the
> interpret-trailers command, IMHO (or if it should be reviewed
> separately, it can be an earlier patch).  That way, someone looking at
> when the command was introduced and wanting to understand what it was
> originally meant to do has the information close by.

Well, the series is not very long, so this patch is quite close to the beginning anyway.

Show 37 quoted lines
> Thanks for picking up the 'git commit --fixes' topic and your steady
> work improving the series.
>
> [...]
>> --- /dev/null
>> +++ b/Documentation/git-interpret-trailers.txt
>> @@ -0,0 +1,123 @@
>> +git-interpret-trailers(1)
>> +=========================
>> +
>> +NAME
>> +----
>> +git-interpret-trailers - help add stuctured information into commit messages
>> +
>> +SYNOPSIS
>> +--------
>> +[verse]
>> +'git interpret-trailers' [--trim-empty] [(<token>[(=|:)<value>])...]
>> +
>> +DESCRIPTION
>> +-----------
>> +Help add RFC 822-like headers, called 'trailers', at the end of the
>> +otherwise free-form part of a commit message.
>> +
>> +This command is a filter. It reads the standard input for a commit
>> +message and applies the `token` arguments, if any, to this
>> +message. The resulting message is emited on the standard output.
>
> Do you have an example?  Does it work like this?
>
>         $ git interpret-trailers 'signoff=Jonathan Nieder <jrnieder@gmail.com>' <<EOF
>         > foo bar baz qux
>         > EOF
>         foo bar baz qux
>
>         Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
>         $
Yeah, that's the idea. But you need to run something like:
$ git config trailer.signoff.key "Signed-off-by:"
to configure it properly first.

By the way trying your example, I found that it is not currently adding an empty line before the s-o-b. I will have a look.

> A short EXAMPLES section could help.
Yeah, it is planned, but not yet implemented, as written in patch 0/11:
"The following features are planned but not yet implemented:
        - add more tests related to commands
        - add examples in documentation
        - integration with "git commit""
> If I am understanding it correctly, would a name like 'git add-trailers'
> work?
It could work but it can modify, not just add trailers.
> How do I read back the trailers later?

Why do you want to read them back? Right now it should be used in hooks to modify commit messages.

Show 6 quoted lines
> [...]
>> +By default, a 'token=value' or 'token:value' argument will be added
>> +only if
>
> Why support both '=' and ':'?  Using just one would make it easier to
> grep through scripts to see who is adding signoffs.

That was already discussed previously. The reason is that people are used to "token=value" for command line arguments, but trailers appears in the result as "token: value", so it is better for the user if we support both.

Thanks, Christian.

Previous: Jonathan NiederNext: Junio C Hamano
Message 17 of 24 in “Add interpret-trailers builtin”
  1. 00/11 Add interpret-trailers builtinChristian Couder, Apr 1, 2014
  2. 01/11 trailer: add data structures and basic functionsChristian Couder, Apr 1, 2014
  3. 02/11 trailer: process trailers from stdin and argumentsChristian Couder, Apr 1, 2014
  4. 03/11 trailer: read and process config informationChristian Couder, Apr 1, 2014
  5. 04/11 trailer: process command line trailer argumentsChristian Couder, Apr 1, 2014
  6. 05/11 trailer: parse trailers from stdinChristian Couder, Apr 1, 2014
  7. 06/11 trailer: put all the processing together and printChristian Couder, Apr 1, 2014
  8. 07/11 trailer: add interpret-trailers commandChristian Couder, Apr 1, 2014
  9. 08/11 trailer: add tests for "git interpret-trailers"Christian Couder, Apr 1, 2014
  10. Junio C HamanoApr 1, 2014
  11. Junio C HamanoApr 1, 2014
  12. Christian CouderApr 2, 2014
  13. 09/11 trailer: execute command from 'trailer.<name>.command'Christian Couder, Apr 1, 2014
  14. 10/11 trailer: add tests for commands in config fileChristian Couder, Apr 1, 2014
  15. 11/11 Documentation: add documentation for 'git interpret-trailers'Christian Couder, Apr 1, 2014
  16. Jonathan NiederApr 2, 2014
  17. Christian CouderApr 2, 2014
  18. Junio C HamanoApr 4, 2014
  19. Junio C HamanoApr 4, 2014
  20. Christian CouderApr 7, 2014
  21. Junio C HamanoApr 7, 2014
  22. Christian CouderApr 7, 2014
  23. Junio C HamanoApr 7, 2014
  24. Junio C HamanoApr 7, 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.