git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Tim LandscheidtNext: Patrick Steinhardt
Message 4 of 6 in “Inconsistent/buggy behaviour of "git config --add"”
  1. Tim LandscheidtMar 23, 2024
  2. Junio C HamanoMar 23, 2024
  3. Tim LandscheidtMar 24, 2024
  4. brian m. carlsonMar 25, 2024
  5. Patrick SteinhardtMar 25, 2024
  6. Junio C HamanoMar 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.