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

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 27, 2014, 22:47 UTC
Message-ID
<xmqqha6jcl96.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140327223406.GA32434@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> All bool config values allow "tRuE".

I was expecting somebody will bring it up, but think about it. Bool is a very special case. Even among CS folks, depending on your background, true may be True may be TRUE may be 1.

Conflating it with some random enum does not make a good argument.
> Ones that take "auto" often use
> strcasecmp (e.g., diff.*.binary). "blame.date" and "help.format" choose
> from a fixed set of tokens, but use strcmp.
I would say that the latter is the right thing to do.
> In general I do not see any reason _not_ to use strcasecmp for config
> values that are matching a fixed set. It's friendlier to the user,...

Actually, I think it ends up being hostile to the users to accept random cases without a good reason. If you see two trailer elements whose where are specified as "after" and "AFTER" in somebody's configuration file, wouldn't that give a wrong impression that a new line with the latter somehow has a stronger desire to come later than the former?

If you consistently take only the fixed strings, you do not have to worry about many people writing the same things in different ways, confusing each other.

I would however fully agree with you that using strcasecmp() would be the cleanest when reading and maintaining the code **IF** we want to accept values in random case, but I do not agree that accepting random cases is a good thing, so...

Previous: Jeff KingNext: Jeff King
Message 12 of 27 in “Add interpret-trailers builtin”
  1. 00/12 Add interpret-trailers builtinChristian Couder, Mar 26, 2014
  2. 01/12 Add data structures and basic functions for commit trailersChristian Couder, Mar 26, 2014
  3. Junio C HamanoMar 26, 2014
  4. Christian CouderMar 27, 2014
  5. 02/12 trailer: process trailers from stdin and argumentsChristian Couder, Mar 26, 2014
  6. 03/12 Move lower case functions into wrapper.cChristian Couder, Mar 26, 2014
  7. Junio C HamanoMar 26, 2014
  8. Christian CouderMar 27, 2014
  9. Junio C HamanoMar 27, 2014
  10. Junio C HamanoMar 27, 2014
  11. Jeff KingMar 27, 2014
  12. Junio C HamanoMar 27, 2014
  13. Jeff KingMar 27, 2014
  14. Junio C HamanoMar 28, 2014
  15. Jeff KingMar 28, 2014
  16. Christian CouderMar 28, 2014
  17. 04/12 trailer: read and process config informationChristian Couder, Mar 26, 2014
  18. 05/12 trailer: process command line trailer argumentsChristian Couder, Mar 26, 2014
  19. 06/12 trailer: parse trailers from stdinChristian Couder, Mar 26, 2014
  20. 07/12 trailer: put all the processing together and printChristian Couder, Mar 26, 2014
  21. 08/12 trailer: add interpret-trailers commandChristian Couder, Mar 26, 2014
  22. 09/12 trailer: add tests for "git interpret-trailers"Christian Couder, Mar 26, 2014
  23. 10/12 trailer: execute command from 'trailer.<name>.command'Christian Couder, Mar 26, 2014
  24. 11/12 trailer: add tests for commands in config fileChristian Couder, Mar 26, 2014
  25. 12/12 Documentation: add documentation for 'git interpret-trailers'Christian Couder, Mar 26, 2014
  26. Junio C HamanoMar 26, 2014
  27. Christian CouderMar 27, 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.