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

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

From
Christian Couder <chriscool@tuxfamily.org>
Date
Apr 25, 2014, 19:56 UTC
Message-ID
<20140425.215619.2296838250398594645.chriscool@tuxfamily.org>
In-Reply-To
<xmqqmwfv3433.fsf@gitster.dls.corp.google.com>
From: Junio C Hamano <gitster@pobox.com>
Show 15 quoted lines
>
> Christian Couder <chriscool@tuxfamily.org> writes:
> 
>> +Help add RFC 822-like headers, called 'trailers', at the end of the
>> +otherwise free-form part of a commit message.
> 
> I think it is somewhat misleading to use the word "headers" like
> that.  'trailers' look similar to RFC-822-headers but they come at
> the end.  The sentence however reads as if they are "headers" that
> look like RFC 822.  Perhaps shuffling words like so:
> 
> 	Help adding 'trailers' lines, that look similar to RFC 822
> 	e-mail headers, at the end of the ...
> 
> would make it less confusing.
Ok, I made this change in v11.
Show 28 quoted lines
>> +Some configuration variables control the way the `token` arguments are
>> +applied to the message and the way any existing trailer in the message
>> +is changed. They also make it possible to automatically add some
>> +trailers.
>> +
>> +By default, a 'token=value' or 'token:value' argument will be added
>> +only if no trailer with the same (token, value) pair is already in the
>> +message. The 'token' and 'value' parts will be trimmed to remove
>> +starting and trailing whitespace, and the resulting trimmed 'token'
>> +and 'value' will appear in the message like this:
>> +
>> +------------------------------------------------
>> +token: value
>> +------------------------------------------------
> 
> Mental note: this does assume that the final output for the 'token'
> is to have a line <label> that is followed by a colon ":", SP and
> the value.
> 
> And the natural way to express that on the command line would be to
> say "token: value", I would think, but let's just read on.
> 
>> +Note that 'trailers' do not follow and are not intended to follow many
>> +rules that are in RFC 822. For example they do not follow the line
>> +breaking rules, the encoding rules and probably many other rules.
> 
> s/that are in RFC 822/for RFC 822 headers/.
> s/line breaking/line folding/. (see RFC 822, 3.1.1)
Ok, it's in v11 too.
Show 14 quoted lines
>> +OPTIONS
>> +-------
>> +--trim-empty::
>> +	If the 'value' part of any trailer contains only whitespace,
>> +	the whole trailer will be removed from the resulting message.
>> +
>> +CONFIGURATION VARIABLES
>> +-----------------------
>> +
>> +trailer.<token>.key::
>> +	This 'key' will be used instead of 'token' in the
> 
> As `key` is something that is typed literally, it should be typeset
> as `key` in the descriptive text.
Ok, I used `key` in v11.
> I think other manpages spell the
> placeholder as `<token>` (or '<token>', I am not sure which...).
I found mostly <token>, so I used that in v11.
Show 24 quoted lines
>> +	trailer. After some alphanumeric characters, it can contain
>> +	some non alphanumeric characters like ':', '=' or '#' that will
>> +	be used instead of ':' to separate the token from the value in
>> +	the trailer, though the default ':' is more standard.
> 
> I assume that this is for things like
> 
> 	bug #538
> 
> and the configuration would say something like:
> 
> 	[trailer "bug"]
>         	key = "bug #"
> 
> For completeness (of this example), the bog-standard s-o-b would
> look like
> 
> 	Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> 
> and the configuration for it that spell the redundant "key" would
> be:
> 
> 	[trailer "Signed-off-by"]
>         	key = "Signed-off-by: "
Yeah, but you can use the following instead:
 	[trailer "s-o-b"]
         	key = "Signed-off-by: "
The <token> and the key can be different.
> Am I reading the intention correctly?
Yeah, I think so.
> That is, when trailer.<token>.key is not defined, the value defaults
> to "<token>: " (with one SP after the label and colon),
Yes.
> and when it
> is defined, the value can come directly after it.
The value can come directly after the key, only if the key ends with '#'.

If it ends with something else, except spaces, one SP will be added between the key and the value.

Yeah, I made '#' special in the hope that it would be more compatible with GitHub and other services that might also use '#'.

Thanks, Christian.

Previous: Junio C HamanoNext: Junio C Hamano
Message 24 of 33 in “Add interpret-trailers builtin”
  1. 00/12 Add interpret-trailers builtinChristian Couder, Apr 6, 2014
  2. 01/12 trailer: add data structures and basic functionsChristian Couder, Apr 6, 2014
  3. 02/12 trailer: process trailers from stdin and argumentsChristian Couder, Apr 6, 2014
  4. 03/12 trailer: read and process config informationChristian Couder, Apr 6, 2014
  5. 04/12 trailer: process command line trailer argumentsChristian Couder, Apr 6, 2014
  6. 05/12 trailer: parse trailers from stdinChristian Couder, Apr 6, 2014
  7. 06/12 trailer: put all the processing together and printChristian Couder, Apr 6, 2014
  8. 07/12 trailer: add interpret-trailers commandChristian Couder, Apr 6, 2014
  9. 08/12 trailer: add tests for "git interpret-trailers"Christian Couder, Apr 6, 2014
  10. 09/12 trailer: execute command from 'trailer.<name>.command'Christian Couder, Apr 6, 2014
  11. 10/12 trailer: add tests for commands in config fileChristian Couder, Apr 6, 2014
  12. 11/12 Documentation: add documentation for 'git interpret-trailers'Christian Couder, Apr 6, 2014
  13. Michael HaggertyApr 8, 2014
  14. Christian CouderApr 8, 2014
  15. Michael HaggertyApr 8, 2014
  16. Christian CouderApr 25, 2014
  17. Michael HaggertyApr 28, 2014
  18. Christian CouderMay 25, 2014
  19. Michael HaggertyMay 27, 2014
  20. Johan HerlandMay 27, 2014
  21. Junio C HamanoMay 27, 2014
  22. Junio C HamanoApr 8, 2014
  23. Junio C HamanoApr 8, 2014
  24. Christian CouderApr 25, 2014
  25. Junio C HamanoApr 28, 2014
  26. Jeremy MortonApr 29, 2014
  27. Christian CouderApr 29, 2014
  28. Jeremy MortonApr 29, 2014
  29. Christian CouderMay 1, 2014
  30. Jeremy MortonApr 29, 2014
  31. 12/12 trailer: add blank line before the trailers if neededChristian Couder, Apr 6, 2014
  32. Junio C HamanoApr 7, 2014
  33. Christian CouderApr 8, 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.