# git_config_set(?) adding and removing creates extraneous lines

2 messages from 2015-06-12 to 2015-06-12. Participants: Anish R Athalye, Matthieu Moy.
Thread: https://gitlist.dev/t/39607

## Anish R Athalye, 2015-06-12 04:59

Subject: git_config_set(?) adding and removing creates extraneous lines
Message-ID: <26A24781-3981-44B6-8174-09532D93774C@mit.edu>
URL: https://gitlist.dev/e/26A24781-3981-44B6-8174-09532D93774C%40mit.edu

```
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, 2015-06-12 05:49

Subject: Re: git_config_set(?) adding and removing creates extraneous lines
Message-ID: <vpqwpz9jx1s.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqwpz9jx1s.fsf%40anie.imag.fr
In-Reply-To: <26A24781-3981-44B6-8174-09532D93774C@mit.edu>

```
Anish R Athalye <aathalye@mit.edu> writes:

> 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/

```
