{"thread":{"id":"39607","subject":"git_config_set(?) adding and removing creates extraneous lines","startedAt":"2015-06-12T04:59:06Z","lastAt":"2015-06-12T05:49:35Z","messageCount":2,"participants":["Anish R Athalye","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"263647","messageId":"26A24781-3981-44B6-8174-09532D93774C@mit.edu","threadId":"39607","inReplyTo":null,"subject":"git_config_set(?) adding and removing creates extraneous lines","fromName":"Anish R Athalye","fromEmail":"aathalye@mit.edu","sentAt":"2015-06-12T04:59:06Z","receivedAt":"2015-06-12T04:59:06Z","isPatch":false,"sender":{"key":"aathalye@mit.edu","avatar":null},"body":"Hi all,\n\nThis 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.\n\nI 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.\n\nTo reproduce:\n\n    git init\n    git commit --allow-empty -m \"Initial commit”\n    git branch --edit-description master # and type in some text\n    git branch --edit-description master # and remove all the text\n    git branch --edit-description master # and type in some text again\n\nNow, when running `tail -n 3 .git/config`, you see:\n\n    [branch \"master\"]\n    [branch \"master\"]\n            description = asdf\\n\n\nThis doesn’t seem right. And if the steps are repeated, the junk accumulates.\nBtw, the output of `git --version` is \"git version 2.2.1”.\n\n\nIs this something that we want to fix?\n\nIf 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.\n\n\n\nRegards,\nAnish"},{"id":"263648","messageId":"vpqwpz9jx1s.fsf@anie.imag.fr","threadId":"39607","inReplyTo":"26A24781-3981-44B6-8174-09532D93774C@mit.edu","subject":"Re: git_config_set(?) adding and removing creates extraneous lines","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-12T05:49:35Z","receivedAt":"2015-06-12T05:49:35Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Anish R Athalye <aathalye@mit.edu> writes:\n\n> Now, when running `tail -n 3 .git/config`, you see:\n>\n>     [branch \"master\"]\n>     [branch \"master\"]\n>             description = asdf\\n\n\nYes, this is a known bug that no one fixed yet. It was planned for\nTanay's (Cc-ed) GSoC last year, but the project evolved in another\ndirection.\n\n> Is this something that we want to fix?\n\nPatches welcome ;-).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}