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

Re: [PATCH v5 00/14] builtin/config: introduce subcommands

From
Karthik Nayak <karthik.188@gmail.com>
Date
May 6, 2024, 11:30 UTC
Message-ID
<CAOLa=ZSK-DxT1J3ZwvaS1kSQS3f-B11yftb5-F5Wu718VQYUxw@mail.gmail.com>
In-Reply-To
<cover.1714982328.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 98 quoted lines
> Hi,
>
> this is the fifth and hopefully last version of my patch sthat
> introduces subcommands into git-config(1).
>
> The only changes compared to v4 are some fixes to commit messages.
> Otherwise I'm not aware of any other feedback that would need to be
> addressed.
>
> Patrick
>
> Patrick Steinhardt (14):
>   config: clarify memory ownership when preparing comment strings
>   builtin/config: move option array around
>   builtin/config: move "fixed-value" option to correct group
>   builtin/config: use `OPT_CMDMODE()` to specify modes
>   builtin/config: pull out function to handle config location
>   builtin/config: pull out function to handle `--null`
>   builtin/config: introduce "list" subcommand
>   builtin/config: introduce "get" subcommand
>   builtin/config: introduce "set" subcommand
>   builtin/config: introduce "unset" subcommand
>   builtin/config: introduce "rename-section" subcommand
>   builtin/config: introduce "remove-section" subcommand
>   builtin/config: introduce "edit" subcommand
>   builtin/config: display subcommand help
>
>  Documentation/git-config.txt | 219 ++++++++-------
>  builtin/config.c             | 512 ++++++++++++++++++++++++++++-------
>  config.c                     |  16 +-
>  config.h                     |   2 +-
>  t/t0450/txt-help-mismatches  |   1 -
>  t/t1300-config.sh            | 432 +++++++++++++++++------------
>  6 files changed, 812 insertions(+), 370 deletions(-)
>
> Range-diff against v4:
>  1:  3aa26d5bff !  1:  881d2b5426 config: clarify memory ownership when preparing comment strings
>     @@ Commit message
>          not like this micro-optimization really matters. Thus, callers are now
>          always responsible for freeing the value.
>
>     +    Signed-off-by: Patrick Steinhardt <ps@pks.im>
>     +
>       ## builtin/config.c ##
>      @@ builtin/config.c: static struct config_options config_options;
>       static int show_origin;
>  2:  8f0804ab48 =  2:  66dffaa8f2 builtin/config: move option array around
>  3:  ddcd8031d7 !  3:  36abda0e02 builtin/config: move "fixed-value" option to correct group
>     @@ Commit message
>          builtin/config: move "fixed-value" option to correct group
>
>          The `--fixed-value` option can be used to alter how the value-pattern
>     -    parameter is interpreted for the various submodes of git-config(1). But
>     -    while it is an option, it is currently listed as part of the submodes
>     -    group the command, which is wrong.
>     +    parameter is interpreted for the various actions of git-config(1). But
>     +    while it is an option, it is currently listed as part of the actions
>     +    group, which is wrong.
>
>          Move the option to the "Other" group, which hosts the various options
>          known to git-config(1).
>  4:  1bc3918840 =  4:  34b66f9c87 builtin/config: use `OPT_CMDMODE()` to specify modes
>  5:  3754812309 =  5:  4f90f206e7 builtin/config: pull out function to handle config location
>  6:  cb1714c493 =  6:  df1a6f14e6 builtin/config: pull out function to handle `--null`
>  7:  b3f3c3ba6a !  7:  1df76a9970 builtin/config: introduce "list" subcommand
>     @@ Commit message
>          builtin/config: introduce "list" subcommand
>
>          While git-config(1) has several modes, those modes are not exposed with
>     -    subcommands but instead by specifying e.g. `--unset` or `--list`. This
>     -    user interface is not really in line with how our more modern commands
>     -    work, where it is a lot more customary to say e.g. `git remote list`.
>     -    Furthermore, to add to the confusion, git-config(1) also allows the user
>     -    to request modes implicitly by just specifying the correct number of
>     -    arguments. Thus, `git config foo.bar` will retrieve the value of
>     -    "foo.bar" while `git config foo.bar baz` will set it to "baz".
>     +    subcommands but instead by specifying action flags like `--unset` or
>     +    `--list`. This user interface is not really in line with how our more
>     +    modern commands work, where it is a lot more customary to say e.g. `git
>     +    remote list`. Furthermore, to add to the confusion, git-config(1) also
>     +    allows the user to request modes implicitly by just specifying the
>     +    correct number of arguments. Thus, `git config foo.bar` will retrieve
>     +    the value of "foo.bar" while `git config foo.bar baz` will set it to
>     +    "baz".
>
>          Overall, this makes for a confusing interface that could really use a
>          makeover. It hurts discoverability of what you can do with git-config(1)
>  8:  0e6da909ac =  8:  29676b81e0 builtin/config: introduce "get" subcommand
>  9:  8a623a31b9 =  9:  94afb5a5b7 builtin/config: introduce "set" subcommand
> 10:  e25e5b69cd = 10:  e525c2326a builtin/config: introduce "unset" subcommand
> 11:  f24008d356 = 11:  a797889890 builtin/config: introduce "rename-section" subcommand
> 12:  fc2ddd3201 = 12:  8ec214755e builtin/config: introduce "remove-section" subcommand
> 13:  4c2d817eff = 13:  1893c23afc builtin/config: introduce "edit" subcommand
> 14:  4c351b12b8 = 14:  97a48ab81d builtin/config: display subcommand help
>
> base-commit: d4cc1ec35f3bcce816b69986ca41943f6ce21377
> --
> 2.45.0

The range diff looks good. Overall I have nothing more to add to this series.

Thanks Karthik

Previous: Patrick SteinhardtNext: Taylor Blau
Message 113 of 116 in “builtin/config: introduce subcommands”
  1. 0/8 builtin/config: introduce subcommandsPatrick Steinhardt, Mar 6, 2024
  2. 1/8 builtin/config: move option array aroundPatrick Steinhardt, Mar 6, 2024
  3. 2/8 builtin/config: move "fixed-value" option to correct groupPatrick Steinhardt, Mar 6, 2024
  4. 3/8 builtin/config: use `OPT_CMDMODE()` to specify modesPatrick Steinhardt, Mar 6, 2024
  5. Taylor BlauMar 6, 2024
  6. Patrick SteinhardtMar 7, 2024
  7. 4/8 builtin/config: move modes into separate functionsPatrick Steinhardt, Mar 6, 2024
  8. 5/8 builtin/config: track subcommands by actionPatrick Steinhardt, Mar 6, 2024
  9. Jean-Noël AVILAMar 6, 2024
  10. Patrick SteinhardtMar 7, 2024
  11. Taylor BlauMar 7, 2024
  12. Patrick SteinhardtMar 7, 2024
  13. 6/8 builtin/config: introduce subcommandsPatrick Steinhardt, Mar 6, 2024
  14. Karthik NayakMar 6, 2024
  15. Patrick SteinhardtMar 7, 2024
  16. 7/8 t1300: exercise both old- and new-style modesPatrick Steinhardt, Mar 6, 2024
  17. 8/8 Documentation/git-config: update to new-style syntaxPatrick Steinhardt, Mar 6, 2024
  18. Eric SunshineMar 7, 2024
  19. Patrick SteinhardtMar 7, 2024
  20. Junio C HamanoMar 6, 2024
  21. Taylor BlauMar 6, 2024
  22. Junio C HamanoMar 6, 2024
  23. Taylor BlauMar 7, 2024
  24. Dragan SimicMar 7, 2024
  25. Patrick SteinhardtMar 7, 2024
  26. Junio C HamanoMar 7, 2024
  27. Kristoffer HaugsbakkMar 6, 2024
  28. 00/13 builtin/config: introduce subcommandsPatrick Steinhardt, Mar 11, 2024
  29. 01/13 builtin/config: move option array aroundPatrick Steinhardt, Mar 11, 2024
  30. 02/13 builtin/config: move "fixed-value" option to correct groupPatrick Steinhardt, Mar 11, 2024
  31. 03/13 builtin/config: use `OPT_CMDMODE()` to specify modesPatrick Steinhardt, Mar 11, 2024
  32. 04/13 builtin/config: pull out function to handle config locationPatrick Steinhardt, Mar 11, 2024
  33. 05/13 builtin/config: pull out function to handle `--null`Patrick Steinhardt, Mar 11, 2024
  34. 06/13 builtin/config: introduce "list" subcommandPatrick Steinhardt, Mar 11, 2024
  35. Eric SunshineMar 13, 2024
  36. Patrick SteinhardtMar 27, 2024
  37. 07/13 builtin/config: introduce "get" subcommandPatrick Steinhardt, Mar 11, 2024
  38. Eric SunshineMar 13, 2024
  39. Patrick SteinhardtMar 27, 2024
  40. 08/13 builtin/config: introduce "set" subcommandPatrick Steinhardt, Mar 11, 2024
  41. 09/13 builtin/config: introduce "unset" subcommandPatrick Steinhardt, Mar 11, 2024
  42. 10/13 builtin/config: introduce "rename-section" subcommandPatrick Steinhardt, Mar 11, 2024
  43. 11/13 builtin/config: introduce "remove-section" subcommandPatrick Steinhardt, Mar 11, 2024
  44. 12/13 builtin/config: introduce "edit" subcommandPatrick Steinhardt, Mar 11, 2024
  45. 13/13 builtin/config: display subcommand helpPatrick Steinhardt, Mar 11, 2024
  46. 00/13 builtin/config: introduce subcommandsPatrick Steinhardt, Mar 27, 2024
  47. 01/13 builtin/config: move option array aroundPatrick Steinhardt, Mar 27, 2024
  48. 02/13 builtin/config: move "fixed-value" option to correct groupPatrick Steinhardt, Mar 27, 2024
  49. 03/13 builtin/config: use `OPT_CMDMODE()` to specify modesPatrick Steinhardt, Mar 27, 2024
  50. 04/13 builtin/config: pull out function to handle config locationPatrick Steinhardt, Mar 27, 2024
  51. 05/13 builtin/config: pull out function to handle `--null`Patrick Steinhardt, Mar 27, 2024
  52. 06/13 builtin/config: introduce "list" subcommandPatrick Steinhardt, Mar 27, 2024
  53. 07/13 builtin/config: introduce "get" subcommandPatrick Steinhardt, Mar 27, 2024
  54. 08/13 builtin/config: introduce "set" subcommandPatrick Steinhardt, Mar 27, 2024
  55. 09/13 builtin/config: introduce "unset" subcommandPatrick Steinhardt, Mar 27, 2024
  56. 10/13 builtin/config: introduce "rename-section" subcommandPatrick Steinhardt, Mar 27, 2024
  57. 11/13 builtin/config: introduce "remove-section" subcommandPatrick Steinhardt, Mar 27, 2024
  58. 12/13 builtin/config: introduce "edit" subcommandPatrick Steinhardt, Mar 27, 2024
  59. 13/13 builtin/config: display subcommand helpPatrick Steinhardt, Mar 27, 2024
  60. Eric SunshineMar 27, 2024
  61. Patrick SteinhardtMar 27, 2024
  62. 00/14 builtin/config: introduce subcommandsPatrick Steinhardt, May 3, 2024
  63. 01/14 config: clarify memory ownership when preparing comment stringsPatrick Steinhardt, May 3, 2024
  64. Kristoffer HaugsbakkMay 3, 2024
  65. 02/14 builtin/config: move option array aroundPatrick Steinhardt, May 3, 2024
  66. 03/14 builtin/config: move "fixed-value" option to correct groupPatrick Steinhardt, May 3, 2024
  67. Karthik NayakMay 3, 2024
  68. Patrick SteinhardtMay 6, 2024
  69. 04/14 builtin/config: use `OPT_CMDMODE()` to specify modesPatrick Steinhardt, May 3, 2024
  70. 05/14 builtin/config: pull out function to handle config locationPatrick Steinhardt, May 3, 2024
  71. 06/14 builtin/config: pull out function to handle `--null`Patrick Steinhardt, May 3, 2024
  72. 07/14 builtin/config: introduce "list" subcommandPatrick Steinhardt, May 3, 2024
  73. Karthik NayakMay 3, 2024
  74. rsbecker@nexbridge.comMay 3, 2024
  75. Junio C HamanoMay 3, 2024
  76. Patrick SteinhardtMay 6, 2024
  77. Junio C HamanoMay 6, 2024
  78. rsbecker@nexbridge.comMay 6, 2024
  79. Dragan SimicMay 6, 2024
  80. Kristoffer HaugsbakkMay 7, 2024
  81. Git 3.0?Junio C Hamano, May 6, 2024
  82. Patrick SteinhardtMay 7, 2024
  83. Patrick SteinhardtMay 7, 2024
  84. Patrick SteinhardtMay 6, 2024
  85. Karthik NayakMay 6, 2024
  86. 08/14 builtin/config: introduce "get" subcommandPatrick Steinhardt, May 3, 2024
  87. 09/14 builtin/config: introduce "set" subcommandPatrick Steinhardt, May 3, 2024
  88. 10/14 builtin/config: introduce "unset" subcommandPatrick Steinhardt, May 3, 2024
  89. 11/14 builtin/config: introduce "rename-section" subcommandPatrick Steinhardt, May 3, 2024
  90. 12/14 builtin/config: introduce "remove-section" subcommandPatrick Steinhardt, May 3, 2024
  91. 13/14 builtin/config: introduce "edit" subcommandPatrick Steinhardt, May 3, 2024
  92. 14/14 builtin/config: display subcommand helpPatrick Steinhardt, May 3, 2024
  93. Dragan SimicMay 3, 2024
  94. Junio C HamanoMay 3, 2024
  95. 00/14 builtin/config: introduce subcommandsPatrick Steinhardt, May 6, 2024
  96. 01/14 config: clarify memory ownership when preparing comment stringsPatrick Steinhardt, May 6, 2024
  97. 02/14 builtin/config: move option array aroundPatrick Steinhardt, May 6, 2024
  98. 03/14 builtin/config: move "fixed-value" option to correct groupPatrick Steinhardt, May 6, 2024
  99. 04/14 builtin/config: use `OPT_CMDMODE()` to specify modesPatrick Steinhardt, May 6, 2024
  100. 05/14 builtin/config: pull out function to handle config locationPatrick Steinhardt, May 6, 2024
  101. 06/14 builtin/config: pull out function to handle `--null`Patrick Steinhardt, May 6, 2024
  102. 07/14 builtin/config: introduce "list" subcommandPatrick Steinhardt, May 6, 2024
  103. 08/14 builtin/config: introduce "get" subcommandPatrick Steinhardt, May 6, 2024
  104. SZEDER GáborAug 3, 2025
  105. Junio C HamanoAug 3, 2025
  106. Patrick SteinhardtSep 11, 2025
  107. 09/14 builtin/config: introduce "set" subcommandPatrick Steinhardt, May 6, 2024
  108. 10/14 builtin/config: introduce "unset" subcommandPatrick Steinhardt, May 6, 2024
  109. 11/14 builtin/config: introduce "rename-section" subcommandPatrick Steinhardt, May 6, 2024
  110. 12/14 builtin/config: introduce "remove-section" subcommandPatrick Steinhardt, May 6, 2024
  111. 13/14 builtin/config: introduce "edit" subcommandPatrick Steinhardt, May 6, 2024
  112. 14/14 builtin/config: display subcommand helpPatrick Steinhardt, May 6, 2024
  113. Karthik NayakMay 6, 2024
  114. Taylor BlauMay 6, 2024
  115. rsbecker@nexbridge.comMay 6, 2024
  116. Patrick SteinhardtMay 7, 2024

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.