Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: <rsbecker@nexbridge.com>
To: "'Junio C Hamano'" <gitster@pobox.com>,
	"'Mike Hommey'" <mh@glandium.org>
Cc: <git@vger.kernel.org>
Subject: RE: bug: git config --global --unset doesn't unset configs in corner case
Date: Fri, 10 May 2024 12:38:49 -0400	[thread overview]
Message-ID: <001b01daa2f8$8cf49800$a6ddc800$@nexbridge.com> (raw)
In-Reply-To: <xmqqmsozuf7y.fsf@gitster.g>

On Thursday, May 9, 2024 12:23 PM, Junio C Hamano wrote:
>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.

If both ~/.gitconfig and ~/.config/git/config both exist, a scope of
--global becomes ambiguous. The --file <file> option should disambiguate the
operation if just --unset is used. Otherwise, perhaps we should fail the
operation.

--Randall


      parent reply	other threads:[~2024-05-10 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09  2:13 bug: git config --global --unset doesn't unset configs in corner case Mike Hommey
2024-05-09 16:23 ` Junio C Hamano
2024-05-10  9:56   ` Patrick Steinhardt
2024-05-10 16:38   ` rsbecker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001b01daa2f8$8cf49800$a6ddc800$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mh@glandium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).