git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git_config_set(?) adding and removing creates extraneous lines

From
AAAnish R Athalye <aathalye@mit.edu>
Date
Jun 12, 2015, 04:59 UTC
Message-ID
<26A24781-3981-44B6-8174-09532D93774C@mit.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

Next: Matthieu Moy
Message 1 of 2 in “git_config_set(?) adding and removing creates extraneous lines”
  1. Anish R AthalyeJun 12, 2015
  2. Matthieu MoyJun 12, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.