{"thread":{"id":"21893","subject":"[BUG] git config does not reuse section name","startedAt":"2009-12-07T17:06:19Z","lastAt":"2009-12-08T03:27:05Z","messageCount":7,"participants":["Yakup Akbay","Junio C Hamano","Sverre Rabbelier","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"129439","messageId":"4B1D360B.4070203@ubicom.com","threadId":"21893","inReplyTo":null,"subject":"[BUG] git config does not reuse section name","fromName":"Yakup Akbay","fromEmail":"yakbay@ubicom.com","sentAt":"2009-12-07T17:06:19Z","receivedAt":"2009-12-07T17:06:19Z","isPatch":false,"sender":{"key":"yakbay@ubicom.com","avatar":"https://gravatar.com/avatar/b1a445348437a895f93c412e183919a84c8b1298747b5e6f285b233225a274cf?d=mp&s=160"},"body":"When I repeat the following n times\n\n    $ git config color.ui always\n    $ git config --unset color.ui\n\n\nit ends up the section name [color] n times in the .git/config file.\n\n\n\nlike this for n=4:\n\n    [color]\n    [color]\n    [color]\n    [color]\n\n\nUsing git version 1.6.5.3 (I don't know whether this is already fixed in \nin later versions)\n\nYakup\n"},{"id":"129440","messageId":"7vy6le35zv.fsf@alter.siamese.dyndns.org","threadId":"21893","inReplyTo":"4B1D360B.4070203@ubicom.com","subject":"Re: [BUG] git config does not reuse section name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-07T20:04:52Z","receivedAt":"2009-12-07T20:04:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yakup Akbay <yakbay@ubicom.com> writes:\n\n> When I repeat the following n times\n>\n>    $ git config color.ui always\n>    $ git config --unset color.ui\n>\n>\n> it ends up the section name [color] n times in the .git/config file.\n>\n>\n>\n> like this for n=4:\n>\n>    [color]\n>    [color]\n>    [color]\n>    [color]\n>\n>\n> Using git version 1.6.5.3 (I don't know whether this is already fixed\n> in in later versions)\n\nIf I recall correctly, this hasn't been even noticed/reported/recognized\nas an issue, ever since the \"git repo-config\" was introduced (which later\nwas renamed to \"git config\").  Dscho, do you remember details?\n"},{"id":"129444","messageId":"fabb9a1e0912071223l21c70e2ax9b0e3c9976ae9d7@mail.gmail.com","threadId":"21893","inReplyTo":"7vy6le35zv.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG] git config does not reuse section name","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-12-07T20:23:20Z","receivedAt":"2009-12-07T20:23:20Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Mon, Dec 7, 2009 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:\n> If I recall correctly, this hasn't been even noticed/reported/recognized\n> as an issue, ever since the \"git repo-config\" was introduced (which later\n> was renamed to \"git config\").\n\nI poked Dscho about it at some point.\n\n> Dscho, do you remember details?\n\nHe told me that the 'git config' code is so horrible that it's\nnigh-impossible to change the behavior, hence why he didn't do it :P.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"129450","messageId":"7vfx7m1p4a.fsf@alter.siamese.dyndns.org","threadId":"21893","inReplyTo":"fabb9a1e0912071223l21c70e2ax9b0e3c9976ae9d7@mail.gmail.com","subject":"Re: [BUG] git config does not reuse section name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-07T20:54:45Z","receivedAt":"2009-12-07T20:54:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> On Mon, Dec 7, 2009 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:\n>> If I recall correctly, this hasn't been even noticed/reported/recognized\n>> as an issue, ever since the \"git repo-config\" was introduced (which later\n>> was renamed to \"git config\").\n>\n> I poked Dscho about it at some point.\n>\n>> Dscho, do you remember details?\n>\n> He told me that the 'git config' code is so horrible that it's\n> nigh-impossible to change the behavior, hence why he didn't do it :P.\n\nHmm, sad.  I thought it was mostly his code...\n"},{"id":"129466","messageId":"alpine.DEB.1.00.0912080258010.4985@pacific.mpi-cbg.de","threadId":"21893","inReplyTo":"7vy6le35zv.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG] git config does not reuse section name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-08T02:01:21Z","receivedAt":"2009-12-08T02:01:21Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 7 Dec 2009, Junio C Hamano wrote:\n\n> Yakup Akbay <yakbay@ubicom.com> writes:\n> \n> > When I repeat the following n times\n> >\n> >    $ git config color.ui always\n> >    $ git config --unset color.ui\n> >\n> >\n> > it ends up the section name [color] n times in the .git/config file.\n> >\n> >\n> >\n> > like this for n=4:\n> >\n> >    [color]\n> >    [color]\n> >    [color]\n> >    [color]\n> >\n> >\n> > Using git version 1.6.5.3 (I don't know whether this is already fixed\n> > in in later versions)\n> \n> If I recall correctly, this hasn't been even noticed/reported/recognized\n> as an issue, ever since the \"git repo-config\" was introduced (which later\n> was renamed to \"git config\").  Dscho, do you remember details?\n\nIIRC, due to technical limitations, the config machinery only recognizes \nsections if there is at least _one_ entry in them.  This is because \ngit_config() is used to determine (from the current file position) where \nthe section begins.\n\nAnd likewise, due to those technical limitations, the section header is \nnot removed when the last entry in the section is removed (this was \nbecause I did not want to change the location of the section, but due to \nthe mentioned limitation, that did not work out).\n\nCiao,\nDscho\n"},{"id":"129468","messageId":"alpine.DEB.1.00.0912080304290.4985@pacific.mpi-cbg.de","threadId":"21893","inReplyTo":"fabb9a1e0912071223l21c70e2ax9b0e3c9976ae9d7@mail.gmail.com","subject":"Re: [BUG] git config does not reuse section name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-08T02:05:58Z","receivedAt":"2009-12-08T02:05:58Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 7 Dec 2009, Sverre Rabbelier wrote:\n\n> On Mon, Dec 7, 2009 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:\n> > If I recall correctly, this hasn't been even \n> > noticed/reported/recognized as an issue, ever since the \"git \n> > repo-config\" was introduced (which later was renamed to \"git config\").\n> \n> I poked Dscho about it at some point.\n> \n> > Dscho, do you remember details?\n> \n> He told me that the 'git config' code is so horrible that it's \n> nigh-impossible to change the behavior, hence why he didn't do it :P.\n\nActually, I said something about the most obvious route being to re-use \ngit_config() and that this approach had its limitations.\n\nI also said that I earned (probably rightfully) a reputation of lousy code \nwith Junio, which makes me think that I probably should refrain from ever \ncontributing code to Git again.\n\nCiao,\nDscho\n"},{"id":"129476","messageId":"7vy6lep2ly.fsf@alter.siamese.dyndns.org","threadId":"21893","inReplyTo":"alpine.DEB.1.00.0912080258010.4985@pacific.mpi-cbg.de","subject":"Re: [BUG] git config does not reuse section name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-08T03:27:05Z","receivedAt":"2009-12-08T03:27:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> IIRC, due to technical limitations, the config machinery only recognizes \n> sections if there is at least _one_ entry in them.  This is because \n> git_config() is used to determine (from the current file position) where \n> the section begins.\n\nAh, the reading side should be able to get by with that parsing logic, as\nan empty section is totally ignorable anyway.  And the parser for the\nwriting side reuses that logic.  Asking for removal code to notice the\nempty section and remove it needs a bit of restructuring of the parsing\nlogic as currently it doesn't even see an empty section.\n\nThanks---the explanation makes sense (I am not saying \"it justifies it\"; I\nonly mean \"it explains why the code behaves like that very well\").\n\nI think we have kept the original parsing structure since repo-config\nadded the write support, and \"fixing\" the issue is not that urgent, but it\nwould be nice to get it fixed.  Perhaps somebody can find some time over\nthe upcoming holidays ;-)\n"}]}