threads / discuss / 39607

git_config_set(?) adding and removing creates extraneous lines

Subject: git_config_set(?) adding and removing creates extraneous lines

## tl;dr

2 messages between Jun 12, 2015 and Jun 12, 2015.

replies: 1people: 2as markdown or json

Anish R Athalye· Jun 12, 2015, 04:59 UTC · lore
Hi all,
This is a very minor bug I noticed (perhaps not even worth fixing because it’s not harmful), but I thought that I’d point it out.
I found that if I used `git branch --edit-description` to add and remove descriptions a couple times, it would accumulate extra lines in my `.git/config` instead of removing lines altogether or combining things where appropriate.
To reproduce:
    git init
    git commit --allow-empty -m "Initial commit”
    git branch --edit-description master # and type in some text
    git branch --edit-description master # and remove all the text
    git branch --edit-description master # and type in some text again
Now, when running `tail -n 3 .git/config`, you see:
    [branch "master"]
    [branch "master"]
            description = asdf\n

This doesn’t seem right. And if the steps are repeated, the junk accumulates. Btw, the output of `git --version` is "git version 2.2.1”.

Is this something that we want to fix?
If yes, and if someone can point me in the right direction, I’d be happy to try to work on it and send in a patch. I think the issue is in the implementation of `git_config_set` and company, but I haven’t really investigated it very deeply.

Regards, Anish

Matthieu Moy· Jun 12, 2015, 05:49 UTC · re: Anish R Athalye · lore

Re: git_config_set(?) adding and removing creates extraneous lines

Anish R Athalye <aathalye@mit.edu> writes:
Show 5 quoted lines
> Now, when running `tail -n 3 .git/config`, you see:
>
>     [branch "master"]
>     [branch "master"]
>             description = asdf\n

Yes, this is a known bug that no one fixed yet. It was planned for Tanay's (Cc-ed) GSoC last year, but the project evolved in another direction.

> Is this something that we want to fix?
Patches welcome ;-).
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads