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

Re: Implementing branch attributes in git config

From
Junio C Hamano <junkio@cox.net>
Date
May 9, 2006, 18:03 UTC
Message-ID
<7vzmhr3wje.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0605091321350.7652@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 11 quoted lines
> Okay, to summarize what people proposed (and that I remember):
>
> 1) [branch."AnY+String"]
>
> 2) multiple [branch]
>
> 3) magic <space>+<quoted>
>
> 4) [branch.just/allow-slashes/and-dashes]
>
> 5) the " for " notation
Thanks for a nice summary.
Show 6 quoted lines
> Now, for the ease of use:
>
> (1), (3) and (4) are in the same league of easiness (except maybe that you 
> have to keep in mind to extra-quote in shell scripts with (1) and (3)), 
> (2) is especially good for people with a database mindset, and (5) is 
> annoying as hell.

One thing you might want to consider is variable types and default values (eh, that makes two).

When Linus first introduced the config mechanism, he made it so that a loosely coupled set of programs can take the "Why should I care about other programs configuration" attitude, and actively encouraged to do so by allowing custom config parsers inherit from the default parser, like the way git_diff_config() falls back on git_default_config() when it does not recognize the variable.

It is quite a good design for most uses, except that it made it inconvenient to implement things like "git-repo-config -l" and "git-var -l". The point of this design _is_ that they cannot know what the set of possible variables, their types and the default values when missing are, so by design the script that used "git-var -l | grep" to read the configuration needed to know that a boolean can be denoted by existence, value set to zero or non-zero integer, or string "true"/"false" (i.e. "filemode", "filemode=1", and "filemode = true" mean the same thing; BTW I think we would probably want to add "yes"/"no" here).

Later it was made easier to use by Pasky with "repo-config --type" option. The caller supplies the name of the variable and the type and repo-config gets the value -- the caller knows what it wants to use, so having it to know what type of things it is interested in is not so bad, so the type problem was practically solved. But it still feels somewhat hacky.

With (2) and (5), we have a bound set of "se.ct.ion.variable"; we could enumerate the variables we care about, define what they mean and what their types and default values are (we need to do that for Documentation/config.txt anyway). With many parts of the standalone git plumbing programs migrating into builtins, I think it is not a bad idea to have a central table of all the configuration variables that the core knows about. Porcelains and scripts could define customized tables that describe the sections/variables they also want to see and act on in the configuration file, and call git-repo-config with that table as an optional parameter.

Show 11 quoted lines
> Now, for the ease of implementation:
>
> (1) and (3) are in the same league, they have to change the way the config 
> is parsed as well as make downcasing conditional in repo-config. (2) is 
> obviously hardest of all. (4) is very easy (one line in config.c), and (5) 
> easiest (nothing to do).
>
> Now, for the versatility, i.e. what you can express with the syntax:
>...
> Obviously, I deem (4) the best solution ATM, because it has all the 
> expressability needed, while being the simplest.

If we are shooting for "let's not do this again", I do not think (4) without some quoting convention is good enough. Today, we are talking about branch names so we could give them artificial limits, which could be weaker than what we already have on the branch names, but we would later regret that, when we start wanting to have other names in the configuration (e.g. people's names).

Previous: Linus TorvaldsNext: Linus Torvalds
Message 46 of 75 in “Implementing branch attributes in git config”
  1. Pavel RoskinMay 7, 2006
  2. Junio C HamanoMay 7, 2006
  3. Johannes SchindelinMay 8, 2006
  4. Linus TorvaldsMay 8, 2006
  5. Linus TorvaldsMay 8, 2006
  6. Linus TorvaldsMay 8, 2006
  7. Johannes SchindelinMay 8, 2006
  8. Pavel RoskinMay 8, 2006
  9. Johannes SchindelinMay 8, 2006
  10. Pavel RoskinMay 8, 2006
  11. Junio C HamanoMay 8, 2006
  12. Johannes SchindelinMay 8, 2006
  13. Pavel RoskinMay 8, 2006
  14. seanMay 8, 2006
  15. Linus TorvaldsMay 8, 2006
  16. Pavel RoskinMay 8, 2006
  17. seanMay 8, 2006
  18. Pavel RoskinMay 8, 2006
  19. Linus TorvaldsMay 8, 2006
  20. Junio C HamanoMay 8, 2006
  21. seanMay 8, 2006
  22. Johannes SchindelinMay 8, 2006
  23. seanMay 8, 2006
  24. Junio C HamanoMay 8, 2006
  25. seanMay 8, 2006
  26. Daniel BarkalowMay 8, 2006
  27. seanMay 8, 2006
  28. Johannes SchindelinMay 8, 2006
  29. seanMay 9, 2006
  30. Johannes SchindelinMay 9, 2006
  31. Linus TorvaldsMay 9, 2006
  32. seanMay 9, 2006
  33. Junio C HamanoMay 9, 2006
  34. Linus TorvaldsMay 9, 2006
  35. Junio C HamanoMay 9, 2006
  36. Linus TorvaldsMay 9, 2006
  37. Junio C HamanoMay 9, 2006
  38. Linus TorvaldsMay 9, 2006
  39. seanMay 9, 2006
  40. Linus TorvaldsMay 9, 2006
  41. seanMay 9, 2006
  42. Linus TorvaldsMay 9, 2006
  43. Jakub NarebskiMay 9, 2006
  44. Johannes SchindelinMay 9, 2006
  45. Linus TorvaldsMay 9, 2006
  46. Junio C HamanoMay 9, 2006
  47. Linus TorvaldsMay 9, 2006
  48. seanMay 9, 2006
  49. seanMay 9, 2006
  50. Junio C HamanoMay 9, 2006
  51. seanMay 9, 2006
  52. Linus TorvaldsMay 10, 2006
  53. seanMay 10, 2006
  54. Linus TorvaldsMay 10, 2006
  55. Martin LanghoffMay 10, 2006
  56. Johannes SchindelinMay 10, 2006
  57. Linus TorvaldsMay 10, 2006
  58. Jakub NarebskiMay 10, 2006
  59. Martin LanghoffMay 10, 2006
  60. Linus TorvaldsMay 10, 2006
  61. Linus TorvaldsMay 11, 2006
  62. Jeff KingMay 11, 2006
  63. Jeff KingMay 11, 2006
  64. Martin LanghoffMay 11, 2006
  65. Johannes SchindelinMay 11, 2006
  66. Nicolas PitreMay 11, 2006
  67. Jakub NarebskiMay 11, 2006
  68. seanMay 10, 2006
  69. Junio C HamanoMay 11, 2006
  70. Martin WaitzMay 9, 2006
  71. Johannes SchindelinMay 9, 2006
  72. Johannes SchindelinMay 8, 2006
  73. Pavel RoskinMay 9, 2006
  74. seanMay 9, 2006
  75. Pavel RoskinMay 9, 2006

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.