[PATCH v2 00/13] builtin/config: introduce subcommands
From: Patrick Steinhardt <hidden>
Date: 2024-03-11 23:19:39
Hi,
this is the second version of my patch series that aims to add
subcommands to git-config(1) in a backwards-compatible manner.
This series is mostly a rewrite compared to v1, so I won't go into all
the details. Most importantly:
- I have replaced several subcommands by option. For example, `git
config get-all` is now `git config get --all` and `git config add`
is `git config set --append`.
- Subcommands now perform their own parsing. This makes the code a
whole lot more easy to reason about and ensures that there are no
backwards incompatible changes to the old modes. This comes at the
cost of additional code though.
- The documentation has been adapted to mention the old syntax in a
"DEPRECATED SYNTAX" section. It also lists how to convert old style
syntax to new style syntax.
As I expect there to be some more discussion and thus some more versions
of this series I stopped short of some things:
- Tests exist for most of the parts, but some modes aren't yet
properly tested. This is mostly due to incompatibilities between old
and new style syntax which make it hard to just run the same tests
twice with some prefixes.
- The `--get-colorbool` option hasn't been converted yet. I _think_ we
might be able to introduce a new `--type=colorbool` option, but I'm
not sure I fully grasp the usecase of this command.
Thanks for all the feedback so far!
Patrick
Patrick Steinhardt (13):
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 | 213 +++++++++------
builtin/config.c | 496 ++++++++++++++++++++++++++++-------
t/t0450/txt-help-mismatches | 1 -
t/t1300-config.sh | 417 ++++++++++++++++++-----------
4 files changed, 786 insertions(+), 341 deletions(-)
base-commit: e09f1254c54329773904fe25d7c545a1fb4fa920
--
2.44.0
Attachments
- signature.asc [application/pgp-signature] 833 bytes