{"thread":{"id":"42305","subject":"Empty config sections are neither deleted nor reused","startedAt":"2016-05-13T14:55:51Z","lastAt":"2016-05-14T18:54:28Z","messageCount":6,"participants":["Jonas Bernoulli","Junio C Hamano","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"286460","messageId":"87r3d6knwo.fsf@bernoul.li","threadId":"42305","inReplyTo":null,"subject":"Empty config sections are neither deleted nor reused","fromName":"Jonas Bernoulli","fromEmail":"jonas@bernoul.li","sentAt":"2016-05-13T14:55:51Z","receivedAt":"2016-05-13T14:55:51Z","isPatch":false,"sender":{"key":"jonas@bernoul.li","avatar":"https://gravatar.com/avatar/67252b2d3a6aacebe15776a6c0cb26c78b475dedc8410caa8765f1f4953222aa?d=mp&s=160"},"body":"After running\n\n  git init .\n  git config foo.bar baz\n  git config --unset foo.bar    # 1\n  git config foo.bar baz        # 2\n\n.git/config contains\n\n  [core]\n          repositoryformatversion = 0\n          filemode = true\n          bare = false\n          logallrefupdates = true\n  [foo]\n  [foo]\n          bar = baz\n\n(1) did not remove the \"foo\" section when the last contained variable\nwas unset and (2) did not reuse the empty \"foo\" section when \"foo.bar\"\nwas set again.\n\nI would prefer if unsetting the last variable in a section would cause\nthe heading of the now empty section would be removed.\n\nBut it might also make sense to not remove an empty section and to\ninstead reuse an empty section.  That would prevent a section from being\nmoved to eof because it became temporarily empty.  Maybe that was the\nintention and Git at some point stopped re-using an empty section?\n\nIt could even be argued that it would make sense for empty sections to\nbe removed *and* reused (in order to \"cleanup\" old empty sections).\n\nThe only possible combination which doesn't make sense is to not remove\nan empty section and to also not reuse an empty section - unfortunately\nthat's what Git currently does.\n\n  Best regards,\n  Jonas\n"},{"id":"286466","messageId":"xmqqeg95aor6.fsf@gitster.mtv.corp.google.com","threadId":"42305","inReplyTo":"87r3d6knwo.fsf@bernoul.li","subject":"Re: Empty config sections are neither deleted nor reused","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-13T16:47:41Z","receivedAt":"2016-05-13T16:47:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonas Bernoulli <jonas@bernoul.li> writes:\n\n> The only possible combination which doesn't make sense is to not remove\n> an empty section and to also not reuse an empty section - unfortunately\n> that's what Git currently does.\n\nIt is not that simple.\n\nThe configuration sections can have comments and they are preserved\neven when they become empty.  Adding something unrelated will still\nmake it appear the stale comment applies to it.\n\nIf you are interested, start here:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/219505/focus=219524\n"},{"id":"286534","messageId":"877fewzseg.fsf@bernoul.li","threadId":"42305","inReplyTo":"xmqqeg95aor6.fsf@gitster.mtv.corp.google.com","subject":"Re: Empty config sections are neither deleted nor reused","fromName":"Jonas Bernoulli","fromEmail":"jonas@bernoul.li","sentAt":"2016-05-14T13:21:59Z","receivedAt":"2016-05-14T13:21:59Z","isPatch":false,"sender":{"key":"jonas@bernoul.li","avatar":"https://gravatar.com/avatar/67252b2d3a6aacebe15776a6c0cb26c78b475dedc8410caa8765f1f4953222aa?d=mp&s=160"},"body":"> The configuration sections can have comments and they are preserved\n> even when they become empty.  Adding something unrelated will still\n> make it appear the stale comment applies to it.\n\nNow that you mention it, I think I have read that before.  Unfortunately\nI forgot about it until you reminded me.  I would still prefer if empty\nsections were removed and/or reused provided no comment is nearby, but\nnow that you reminded me why the current behavior is how it is, I can\nlive with it.\n\nThanks for the link.\n\n  Jonas\n"},{"id":"286536","messageId":"vpq37pk7k08.fsf@anie.imag.fr","threadId":"42305","inReplyTo":"877fewzseg.fsf@bernoul.li","subject":"Re: Empty config sections are neither deleted nor reused","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2016-05-14T15:10:47Z","receivedAt":"2016-05-14T15:10:47Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Jonas Bernoulli <jonas@bernoul.li> writes:\n\n>> The configuration sections can have comments and they are preserved\n>> even when they become empty.  Adding something unrelated will still\n>> make it appear the stale comment applies to it.\n>\n> Now that you mention it, I think I have read that before.  Unfortunately\n> I forgot about it until you reminded me.  I would still prefer if empty\n> sections were removed and/or reused provided no comment is nearby, but\n> now that you reminded me why the current behavior is how it is, I can\n> live with it.\n\nJunio's explanation must not necessarily be read as \"it has to be the\nway it is\", but more as \"getting it right is harder than you think\", and\nthat in turn explains why no one changed the behavior.\n\nActually, Tanay Abhra's GSoC two years ago included working on this, but\nthe project had other priorities and the empty sections issue was not\ntackled.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"286539","messageId":"xmqqfutk8ryy.fsf@gitster.mtv.corp.google.com","threadId":"42305","inReplyTo":"vpq37pk7k08.fsf@anie.imag.fr","subject":"Re: Empty config sections are neither deleted nor reused","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-14T17:33:25Z","receivedAt":"2016-05-14T17:33:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Junio's explanation must not necessarily be read as \"it has to be the\n> way it is\", but more as \"getting it right is harder than you think\", and\n> that in turn explains why no one changed the behavior.\n\nThanks for clarification.  s/must not necessarily/must not/;\n"},{"id":"286546","messageId":"878tzc1ndn.fsf@bernoul.li","threadId":"42305","inReplyTo":"xmqqfutk8ryy.fsf@gitster.mtv.corp.google.com","subject":"Re: Empty config sections are neither deleted nor reused","fromName":"Jonas Bernoulli","fromEmail":"jonas@bernoul.li","sentAt":"2016-05-14T18:54:28Z","receivedAt":"2016-05-14T18:54:28Z","isPatch":false,"sender":{"key":"jonas@bernoul.li","avatar":"https://gravatar.com/avatar/67252b2d3a6aacebe15776a6c0cb26c78b475dedc8410caa8765f1f4953222aa?d=mp&s=160"},"body":"\nJunio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> Junio's explanation must not necessarily be read as \"it has to be the\n>> way it is\", but more as \"getting it right is harder than you think\", and\n>> that in turn explains why no one changed the behavior.\n>\n> Thanks for clarification.  s/must not necessarily/must not/;\n\nThat's how I read it too ;-)\n\nApparently my reply left more room for interpretation.\n"}]}