Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Minor bug in git branch --set-upstream-to adding superfluous branch section to config

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:34

Phil Haack [off-list ref] writes:
Hello there! Please /cc me with responses as I'm not on the mailing list.

I'm using git version 1.8.1.msysgit.1 and I ran into a very minor issue. It
doesn't actually seem to affect operations, but I thought I'd report it in case
someone felt it was worth cleaning up.
I do not think this is limited to "branch --set-whatever".
If you run the following set of commands:

    git checkout -b some-branch
    git push origin some-branch
    git branch --set-upstream-to origin/some-branch
    git branch --unset-upstream some-branch
This step causes the removal of the last variable in a configuration
section, which leaves an empty section.  As the code to add a new
variable to the configuration, trying to reuse an existing section
header, does not pay attention to an empty section, you end up with
an empty section, followed by a new one.

Either removal of configuration variable should be taught to remove
the section header when a section becomes empty, or addition of
configuration variable should be taught to notice an empty section
header.


    git branch --set-upstream-to origin/some-branch

You get the following result in the .git\config file

    [branch "some-branch"]
    [branch "some-branch"]
        remote = origin
        merge = refs/heads/some-branch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help