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

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

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 25, 2024, 07:28 UTC
Message-ID
<ZgEnqE23PYVCNeKc@tanuki>
In-Reply-To
<87o7b3xxta.fsf@vagabond.tim-landscheidt.de>
On Sun, Mar 24, 2024 at 06:57:21PM +0000, Tim Landscheidt wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
[snip]
Show 12 quoted lines
> >> 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@pks.im/
Previous: brian m. carlsonNext: Junio C Hamano
Message 5 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.