git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug: duplicate sections in .git/config after remote removal
@ 2018-03-27 20:41 Jason Frey
  2018-03-27 21:45 ` Stefan Beller
  2018-03-27 21:49 ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 8+ messages in thread
From: Jason Frey @ 2018-03-27 20:41 UTC (permalink / raw)
  To: git

While the impact of this bug is minimal, and git itself is not
affected, it can affect external tools that want to read the
.git/config file, expecting unique section names.

To reproduce:

Given the following example .git/config file (I am leaving out the
[core] section for brevity):

    [remote "origin"]
        url = git@github.com:Fryguy/example.git
        fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
        remote = origin
        merge = refs/heads/master

Running `git remote rm origin` will result in the following contents:

    [branch "master"]

Running `git remote add origin git@github.com:Fryguy/example.git` will
result in the following contents:

    [branch "master"]
    [remote "origin"]
        url = git@github.com:Fryguy/example.git
        fetch = +refs/heads/*:refs/remotes/origin/*

And finally, running `git fetch origin; git branch -u origin/master`
will result in the following contents:

    [branch "master"]
    [remote "origin"]
        url = git@github.com:Fryguy/example.git
        fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
        remote = origin
        merge = refs/heads/master

at which point you can see the duplicate sections (even though one is
empty).  Also note that if you do the steps again, you will be left
with 3 sections, 2 of which are empty.  This process can be repeated
over and over.

Thanks,
Jason

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-28 16:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 20:41 Bug: duplicate sections in .git/config after remote removal Jason Frey
2018-03-27 21:45 ` Stefan Beller
2018-03-28 16:34   ` Johannes Schindelin
2018-03-27 21:49 ` Ævar Arnfjörð Bjarmason
2018-03-28  7:54   ` Philip Oakley
2018-03-28  7:54   ` Philip Oakley
2018-03-28  7:55   ` Philip Oakley
2018-03-28  8:06   ` Philip Oakley

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).