Skip to content

builtin/config: introduce subcommands

Patrick Steinhardt requested to merge pks-config-subcommands into master

The UI of git-config(1) is quite arcane and does not really conform to the more modern UIs that we have nowadays in Git:

  • While it does have modes, those modes come in the form of switches. E.g. you have to say git config --get-all to execute the "get-all" mode.
  • Its interface depends on the number of args. Given one arg it will print the value of the corresponding config key, given two args it will set that key. Did you know you can even give it three args? I didn't. Now guess what this mode does.

I'm thus prepping a patch series which introduces proper subcommands so that you can say git config list, git config set foo.bar baz and git config rename-section foo bar. To do this without breaking backwards compatibility I'm using a small trick: in all cases, the first non-option argument must be a config key, and config keys always have a dot. Thus, none of the newly introduced subcommands can ever conflict with the old style usage of this command.Let's see how this will be received upstream.

Closes #276 (closed).

Edited by Patrick Steinhardt

Merge request reports