Re: Inconsistent/buggy behaviour of "git config --add"
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Mar 25, 2024, 00:31 UTC
- Message-ID
- <ZgDF3uIEYNbawplE@tapette.crustytoothpaste.net>
- In-Reply-To
- <87o7b3xxta.fsf@vagabond.tim-landscheidt.de>
On 2024-03-24 at 18:57:21, Tim Landscheidt wrote:
Show 13 quoted lines
> Junio C Hamano <gitster@pobox.com> wrote: > >> 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).
POSIX mandates that all options come before all non-option arguments. So by that rule, `git config section.key --add value` means that `--add` is a non-option argument, not the option `--add`.
Certainly some GNU tools do break the rule, and Git begrudgingly allows it in some cases, but in utilities in general, it isn't allowed. Many non-Linux OSes and non-GNU tools don't allow options to appear after non-option arguments at all.
-- brian m. carlson (they/them or he/him) Toronto, Ontario, CA