Subject: Re: Inconsistent/buggy behaviour of "git config --add"

From: "brian m. carlson" <[email-masked]>
Date: Mon, 25 Mar 2024 00:31:26 +0000

On 2024-03-24 at 18:57:21, Tim Landscheidt wrote:
> Junio C Hamano <[email-masked]> 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