On Sun, Mar 24, 2024 at 06:57:21PM +0000, Tim Landscheidt wrote: > Junio C Hamano <gitster@xxxxxxxxx> wrote: [snip] > >> My expectation of least surprise is that "git config > >> section.key --add value" should be equivalent to "git config > >> --add section.key value". > > > You cannot have "--add" as a value by doing so. > > > […] > > The standard way to achieve this would be to use "--", > i. e. "git config section.key --add -- --add" (apparently > even part of POSIX as "Utility Syntax Guidelines", but also > commonly used elsewhere in Git). I think the whole design of git-config(1) is just not great, and I'm not surprised at all that folks run into issues like the one you describe here. I agree that it is quite surprising that modes like "--add" look like a flag, but don't really behave like one in the general case. This is part of the reason why I have recently proposed to convert this command to use proper subcommands [1]. This introduces things like `git config set`, `git config list`, `git config get`, `git config unset` that (in my opinion) behave a lot more obvious. Also, I certainly agree with you that those subcommands should respect "--" as many other of our Git commands already do. I plan to reroll this patch series soonish. Please feel free to provide your feedback on it so that we can iterate on the proposed UI/UX and make it match user's expectations better. Patrick [1]: https://lore.kernel.org/git/cover.1710198711.git.ps@xxxxxx/
Attachment:
signature.asc
Description: PGP signature