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

Re: Questions about trailer configuration semantics

From
Jeff King <peff@peff.net>
Date
Jul 27, 2020, 23:42 UTC
Message-ID
<20200727234217.GA802697@coredump.intra.peff.net>
In-Reply-To
<875za8r2fu.fsf@0x63.nu>
On Tue, Jul 28, 2020 at 12:57:51AM +0200, Anders Waldenborg wrote:
Show 19 quoted lines
> >> > > When configuring a value in trailer.<token>.key it causes the trailer to
> >> > > be normalized to that in "git interpret-trailers --parse".
> >> > > E.g:
> >> > >  $ printf '\naCKed: Zz\n' | \
> >> > >    git -c 'trailer.Acked.key=Acked' interpret-trailers --parse
> >> > >  will emit: "Acked: Zz"
> >>
> >> Yeah, I think that's nice, as it can make sure that the key appears in
> >> the same way. It's true that it would be better if it would be
> >> documented.
> >
> > I'd note that this also happens without --parse.
> 
> Right, and it also happens with "--only-input" (part of "--parse")
> 
> "--only-input" is documented as follows:
> 
>    Output only trailers that exist in the input; do not add any from the
>    command-line or by following configured trailer.* rules.

I think I meant there only that we wouldn't add new trailers (e.g., from "trailers.*.ifMissing"). But I do agree that it might be simpler if we can just say "we don't look at trailer.<token>.* config at all in --only-input mode. I _think_ that's true (we probably do look at trailer.separators, but the rest of the token-specific ones look like they're all about writing or modifying, not reading).

Show 9 quoted lines
> > I don't recall being aware of this prefix matching until this thread, so
> > I doubt that the current behavior of --parse was something I tried for
> > intentionally. It's mostly just using the existing code, plus a few
> > extra options (listed in the docs). I'm not opposed to adding an option
> > to do strict matching and/or avoid rewriting, and then possibly adding
> > that into --parse by default.
> 
> Would that option also be set for the parsing done by "%(trailers)"
> pretty format specifier?

I thnk %(trailers) isn't quite the same as "--parse", because you have to say "only" or "unfold" yourself. But yeah, that option should certainly be available there, if not the default.

Show 9 quoted lines
> > I don't have much of an opinion on which behavior would be preferred.
> > I've never actually had a use case for configuring trailer.*.key, as I
> > usually am only looking at reading existing trailers to collect stats,
> > etc.
> 
> I'm also mainly using in reading trailers (mostly with pretty format
> "%(trailers:key=x)") and then these convenience shortcuts doesn't really
> seem helpful, they rather add a small risk of mangling my data. Not that
> this has caused any problems for me in practice.

Yeah, pondering it a bit more, I think trailer.<token>.* doesn't really make any sense for any reading operation (including %(trailers) or --parse). I guess it _could_ be useful to normalize names in some instances, but it's as likely to confuse or break somebody as to help.

-Peff
Previous: Anders WaldenborgNext: Junio C Hamano
Message 6 of 16 in “Questions about trailer configuration semantics”
  1. Anders WaldenborgJul 27, 2020
  2. Junio C HamanoJul 27, 2020
  3. Christian CouderJul 27, 2020
  4. Jeff KingJul 27, 2020
  5. Anders WaldenborgJul 27, 2020
  6. Jeff KingJul 27, 2020
  7. Junio C HamanoJul 27, 2020
  8. Anders WaldenborgJul 27, 2020
  9. Junio C HamanoJul 27, 2020
  10. Anders WaldenborgJul 28, 2020
  11. Anders WaldenborgJul 27, 2020
  12. Junio C HamanoJul 27, 2020
  13. Anders WaldenborgJul 27, 2020
  14. Christian CouderJul 28, 2020
  15. Jeff KingJul 28, 2020
  16. Junio C HamanoJul 28, 2020

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.