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

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

From
Christian Couder <christian.couder@gmail.com>
Date
Aug 21, 2014, 03:39 UTC
Message-ID
<CAP8UFD3hi6rRS=Z9dvbpvW75_K5mN5mPaxQdx3ATYOwXbuw3Pw@mail.gmail.com>
In-Reply-To
<53F51B98.2060903@xiplink.com>
On Thu, Aug 21, 2014 at 12:05 AM, Marc Branchaud <marcnarc@xiplink.com> wrote:
Show 8 quoted lines
> On 14-08-16 12:06 PM, Christian Couder wrote:
>
>> +The trailers are recognized in the input message using the following
>> +rules:
>> +
>> +* by default only lines that contains a ':' (colon) are considered
>
> s/contains/contain/
Ok.
Show 9 quoted lines
>> +  trailers,
>> +
>> +* the trailer lines must all be next to each other,
>> +
>> +* after them it's only possible to have some lines that contain only
>> +  spaces, and then a patch; the patch part is recognized using the
>> +  fact that its first line starts with '---' (three minus signs),
>
> Is that "starts with" or "consists solely of"?
It is starts with. (The starts_with() function is used.)
Show 11 quoted lines
>> +
>> +* before them there must be at least one line with only spaces.
>
> I had little bit of trouble parsing those three points, and it seems like a
> lot of text to describe something simple.  How about a single paragraph:
>
> Existing trailers are extracted from the input message by looking for a group
> of one or more lines that contain a colon (by default), where the group is
> preceded by one or more empty (or whitespace-only) lines.  The group must
> either be at the end of the message or be the last non-whitespace lines
> before a line that starts with '---' (three minus signs).
Ok, I will use something like that, thanks.
> Also, will a trailer be recognized if there is whitespace before and/or after
> the separator?
Yes.
> Can there be whitespace before the token?
Yes.
>  In the token?
Yes.
> (I don't feel strongly about the answers to these questions, they just came to
> mind as I read the documentation.)
Ok, I will add something.
Show 55 quoted lines
>> +Note that 'trailers' do not follow and are not intended to follow many
>> +rules for RFC 822 headers. For example they do not follow the line
>> +folding rules, the encoding rules and probably many other rules.
>> +
>> +OPTIONS
>> +-------
>> +--trim-empty::
>> +     If the <value> part of any trailer contains only whitespace,
>> +     the whole trailer will be removed from the resulting message.
>> +     This apply to existing trailers as well as new trailers.
>> +
>> +--trailer <token>[(=|:)<value>]::
>> +     Specify a (<token>, <value>) pair that should be applied as a
>> +     trailer to the input messages. See the description of this
>> +     command.
>> +
>> +CONFIGURATION VARIABLES
>> +-----------------------
>> +
>> +trailer.separators::
>> +     This option tells which characters are recognized as trailer
>> +     separators. By default only ':' is recognized as a trailer
>> +     separator, except that '=' is always accepted on the command
>> +     line for compatibility with other git commands.
>> ++
>> +The first character given by this option will be the default character
>> +used when another separator is not specified in the config for this
>> +trailer.
>> ++
>> +For example, if the value for this option is "%=$", then only lines
>> +using the format '<token><sep><value>' with <sep> containing '%', '='
>> +or '$' and then spaces will be considered trailers. And '%' will be
>> +the default separator used, so by default trailers will appear like:
>> +'<token>% <value>' (one percent sign and one space will appear between
>> +the token and the value).
>> +
>> +trailer.where::
>> +     This option tells where a new trailer will be added.
>> ++
>> +This can be `end`, which is the default, `start`, `after` or `before`.
>> ++
>> +If it is `end`, then each new trailer will appear at the end of the
>> +existing trailers.
>> ++
>> +If it is `start`, then each new trailer will appear at the start,
>> +instead of the end, of the existing trailers.
>> ++
>> +If it is `after`, then each new trailer will appear just after the
>> +last trailer with the same <token>.
>> ++
>> +If it is `before`, then each new trailer will appear just before the
>> +last trailer with the same <token>.
>
> It seems to me that it would be more sensible to make the new trailer appear
> before the *first* trailer with the same token.
Yeah, it is a copy-paste mistake that I will fix.

Thanks for the careful review, Christian.

Previous: Marc BranchaudNext: Marc Branchaud
Message 14 of 18 in “Add interpret-trailers builtin”
  1. 00/11 Add interpret-trailers builtinChristian Couder, Aug 16, 2014
  2. 01/11 trailer: add data structures and basic functionsChristian Couder, Aug 16, 2014
  3. 02/11 trailer: process trailers from input message and argumentsChristian Couder, Aug 16, 2014
  4. 03/11 trailer: read and process config informationChristian Couder, Aug 16, 2014
  5. 04/11 trailer: process command line trailer argumentsChristian Couder, Aug 16, 2014
  6. 05/11 trailer: parse trailers from file or stdinChristian Couder, Aug 16, 2014
  7. 06/11 trailer: put all the processing together and printChristian Couder, Aug 16, 2014
  8. 07/11 trailer: add interpret-trailers commandChristian Couder, Aug 16, 2014
  9. 08/11 trailer: add tests for "git interpret-trailers"Christian Couder, Aug 16, 2014
  10. 09/11 trailer: execute command from 'trailer.<name>.command'Christian Couder, Aug 16, 2014
  11. 10/11 trailer: add tests for commands in config fileChristian Couder, Aug 16, 2014
  12. 11/11 Documentation: add documentation for 'git interpret-trailers'Christian Couder, Aug 16, 2014
  13. Marc BranchaudAug 20, 2014
  14. Christian CouderAug 21, 2014
  15. Marc BranchaudAug 21, 2014
  16. Christian CouderAug 16, 2014
  17. Junio C HamanoSep 3, 2014
  18. Christian CouderSep 15, 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.