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

Re: Parsing trailers

From
Christian Couder <christian.couder@gmail.com>
Date
Dec 24, 2018, 10:58 UTC
Message-ID
<CAP8UFD1ErRo7NQmCrAJLaELzV-1rKowyPsNCi3ecTqGN1qWxKQ@mail.gmail.com>
In-Reply-To
<CAFW+GMDazFSDzBrvzMqaPGwew=+CP7tw7G5FfDqcAUYd3qjPuQ@mail.gmail.com>
On Sun, Dec 23, 2018 at 11:44 PM William Chargin <wchargin@gmail.com> wrote:
Show 6 quoted lines
>
> I'm interested in parsing the output of `git-interpret-trailers` in a
> script. I had hoped that the `--parse` option would make this easy, but
> it seems that the `trailer.separators` configuration option is used to
> specify both the input format (which separators may indicate a trailer)
> and the output format of `git interpret-trailers --parse`.

Yeah, but it can take many characters, not just one. For example you might want to do something like:

seps=$(git config trailer.separators) test -z "$seps" && seps=':' git -c trailer.separators="|$seps" interpret-trailers --parse infile >outfile

So that the output uses '|' as a separator.
> Given that
> `trailer.separators` may contain any (non-NUL) characters, including
> whitespace, parsing the output is not straightforward.

Changing the default separator as shown above, should make it easier to parse the result.

Previous: William CharginNext: William Chargin
Message 2 of 8 in “Parsing trailers”
  1. William CharginDec 23, 2018
  2. Christian CouderDec 24, 2018
  3. William CharginDec 24, 2018
  4. Christian CouderDec 26, 2018
  5. William CharginDec 26, 2018
  6. Jeff KingJan 3, 2019
  7. William CharginJan 3, 2019
  8. Jeff KingJan 3, 2019

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.