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

Re: bug: git config --global --unset doesn't unset configs in corner case

From
Junio C Hamano <gitster@pobox.com>
Date
May 9, 2024, 16:23 UTC
Message-ID
<xmqqmsozuf7y.fsf@gitster.g>
In-Reply-To
<20240509021352.se4u7ajaolveyyjf@glandium.org>
Mike Hommey <mh@glandium.org> writes:
> When both ~/.gitconfig and ~/.config/git/config exist, git will read
> both. But when using `git config --global --unset`, it will only touch
> the first one. So unsetting config items from ~/.config/git/config is
> not possible from the command line when ~/.gitconfig exists.
Interesting observation of an understandable behaviour.

I think the original intent of limiting the writing to just one was to avoid having both files in the first place. When both do exist already, I am not sure what the right behaviour on the write side should be. We could special case "--unset-all" and remove from both, but "--unset" is to remove just one, so when the reading side reads from both, it becomes "which one to remove"?

Comments from those who are more familiar with the "git config" are certainly appreciated.

Thanks.
Previous: Mike HommeyNext: Patrick Steinhardt
Message 2 of 4 in “bug: git config --global --unset doesn't unset configs in corner case”
  1. Mike HommeyMay 9, 2024
  2. Junio C HamanoMay 9, 2024
  3. Patrick SteinhardtMay 10, 2024
  4. rsbecker@nexbridge.comMay 10, 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.