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
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2014, 16:52 UTC
Message-ID
<xmqq7g6zlq5a.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5343A589.10503@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Sorry for reappearing in this thread after such a long absence.  I
> wanted to see what is coming up (I think this interpret-trailers command
> will be handy!) so I read this documentation patch carefully, and added
> some questions and suggestions below.

Thanks for reading the patch carefully. It helps to have fresh set of eyes that are not contaminated by the preconception formed by previous discussions, especially when reviewing the documentation whose primary target audiences are those who do not care about these previous back-and-forth.

Show 18 quoted lines
>> +trailer.<token>.where::
>> +	This can be either `after`, which is the default, or
>> +	`before`. If it is `before`, then a trailer with the specified
>> +	token, will appear before, instead of after, other trailers
>> +	with the same token, or otherwise at the beginning, instead of
>> +	at the end, of all the trailers.
>
> Brainstorming: some other options that might make sense here someday:
> ...
>> +trailer.<token>.ifexist::
>> +	This option makes it possible to choose what action will be
>> +	performed when there is already at least one trailer with the
>> +	same token in the message.
>> ++
>> +The valid values for this option are: `addIfDifferent` (this is the
>> +default), `addIfDifferentNeighbor`, `add`, `overwrite` or `doNothing`.
>
> Are these option values case sensitive?

It is interesting and somewhat sad that it all has to come back together inter-twined. From the very beginning, I was opposed to having logical complexity that requires multi-words in both variable names (e.g. "if-exist") and values (e.g. "add-if-different"), and after $gmane/241929 where I let the devil's advocate "how about making the variable simpler without logical operation and put all the conditional on the value side?" suggestion shot down, I somehow was hoping that the value part got a lot simpler not to require multi-words, which would have meant that we would not have to worry about "Is it addIfDifferent? add-if-different? or Add_If_Different?" at all. Sadly that is not what we have ended up with.

So, with that realization...
Show 5 quoted lines
> If so, it might be a little bit
> confusing because the same camel-case is often used in documentation for
> configuration *keys*, which are not case sensitive [1], and users might
> have gotten used to thinking of strings that look like this to be
> non-case-sensitive.

... very true. Having to have these enum values as so complex to require multi-words is probably the root cause of the confusion, and we might probably be better off if we did not have to, but it would be helpful to allow various different spellings (i.e. make them case insensitive to allow random camel spellings, and also accept things like "add-if-different" as well) if we absolutely have to have these complex values.

But you had a lot of good questions and suggestions for possible future enhancements that we would need to take into account while designing the overall scheme to later allow them to fit into. Maybe a value that is a single-token that consists of just a few words (e.g. "addIfDifferent") may not be the best way to go after all.

I dunno.
> What if there are multiple existing trailers with the same token?  Are
> they all overwritten?
> ...
> What if the key appears multiple times in existing trailers?
All good questions, I would think.
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 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.