Git development
 help / color / mirror / Atom feed
* [BUG] git config does not reuse section name
@ 2009-12-07 17:06 Yakup Akbay
  2009-12-07 20:04 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Yakup Akbay @ 2009-12-07 17:06 UTC (permalink / raw)
  To: git

When I repeat the following n times

    $ git config color.ui always
    $ git config --unset color.ui


it ends up the section name [color] n times in the .git/config file.



like this for n=4:

    [color]
    [color]
    [color]
    [color]


Using git version 1.6.5.3 (I don't know whether this is already fixed in 
in later versions)

Yakup

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] git config does not reuse section name
  2009-12-07 17:06 [BUG] git config does not reuse section name Yakup Akbay
@ 2009-12-07 20:04 ` Junio C Hamano
  2009-12-07 20:23   ` Sverre Rabbelier
  2009-12-08  2:01   ` Johannes Schindelin
  0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2009-12-07 20:04 UTC (permalink / raw)
  To: Yakup Akbay; +Cc: git, Johannes Schindelin

Yakup Akbay <yakbay@ubicom.com> writes:

> When I repeat the following n times
>
>    $ git config color.ui always
>    $ git config --unset color.ui
>
>
> it ends up the section name [color] n times in the .git/config file.
>
>
>
> like this for n=4:
>
>    [color]
>    [color]
>    [color]
>    [color]
>
>
> Using git version 1.6.5.3 (I don't know whether this is already fixed
> in in later versions)

If I recall correctly, this hasn't been even noticed/reported/recognized
as an issue, ever since the "git repo-config" was introduced (which later
was renamed to "git config").  Dscho, do you remember details?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] git config does not reuse section name
  2009-12-07 20:04 ` Junio C Hamano
@ 2009-12-07 20:23   ` Sverre Rabbelier
  2009-12-07 20:54     ` Junio C Hamano
  2009-12-08  2:05     ` Johannes Schindelin
  2009-12-08  2:01   ` Johannes Schindelin
  1 sibling, 2 replies; 7+ messages in thread
From: Sverre Rabbelier @ 2009-12-07 20:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Yakup Akbay, git, Johannes Schindelin

Heya,

On Mon, Dec 7, 2009 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:
> If I recall correctly, this hasn't been even noticed/reported/recognized
> as an issue, ever since the "git repo-config" was introduced (which later
> was renamed to "git config").

I poked Dscho about it at some point.

> Dscho, do you remember details?

He told me that the 'git config' code is so horrible that it's
nigh-impossible to change the behavior, hence why he didn't do it :P.

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] git config does not reuse section name
  2009-12-07 20:23   ` Sverre Rabbelier
@ 2009-12-07 20:54     ` Junio C Hamano
  2009-12-08  2:05     ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2009-12-07 20:54 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, Yakup Akbay, git, Johannes Schindelin

Sverre Rabbelier <srabbelier@gmail.com> writes:

> On Mon, Dec 7, 2009 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:
>> If I recall correctly, this hasn't been even noticed/reported/recognized
>> as an issue, ever since the "git repo-config" was introduced (which later
>> was renamed to "git config").
>
> I poked Dscho about it at some point.
>
>> Dscho, do you remember details?
>
> He told me that the 'git config' code is so horrible that it's
> nigh-impossible to change the behavior, hence why he didn't do it :P.

Hmm, sad.  I thought it was mostly his code...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] git config does not reuse section name
  2009-12-07 20:04 ` Junio C Hamano
  2009-12-07 20:23   ` Sverre Rabbelier
@ 2009-12-08  2:01   ` Johannes Schindelin
  2009-12-08  3:27     ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2009-12-08  2:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Yakup Akbay, git

Hi,

On Mon, 7 Dec 2009, Junio C Hamano wrote:

> Yakup Akbay <yakbay@ubicom.com> writes:
> 
> > When I repeat the following n times
> >
> >    $ git config color.ui always
> >    $ git config --unset color.ui
> >
> >
> > it ends up the section name [color] n times in the .git/config file.
> >
> >
> >
> > like this for n=4:
> >
> >    [color]
> >    [color]
> >    [color]
> >    [color]
> >
> >
> > Using git version 1.6.5.3 (I don't know whether this is already fixed
> > in in later versions)
> 
> If I recall correctly, this hasn't been even noticed/reported/recognized
> as an issue, ever since the "git repo-config" was introduced (which later
> was renamed to "git config").  Dscho, do you remember details?

IIRC, due to technical limitations, the config machinery only recognizes 
sections if there is at least _one_ entry in them.  This is because 
git_config() is used to determine (from the current file position) where 
the section begins.

And likewise, due to those technical limitations, the section header is 
not removed when the last entry in the section is removed (this was 
because I did not want to change the location of the section, but due to 
the mentioned limitation, that did not work out).

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] git config does not reuse section name
  2009-12-07 20:23   ` Sverre Rabbelier
  2009-12-07 20:54     ` Junio C Hamano
@ 2009-12-08  2:05     ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2009-12-08  2:05 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, Yakup Akbay, git

Hi,

On Mon, 7 Dec 2009, Sverre Rabbelier wrote:

> On Mon, Dec 7, 2009 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:
> > If I recall correctly, this hasn't been even 
> > noticed/reported/recognized as an issue, ever since the "git 
> > repo-config" was introduced (which later was renamed to "git config").
> 
> I poked Dscho about it at some point.
> 
> > Dscho, do you remember details?
> 
> He told me that the 'git config' code is so horrible that it's 
> nigh-impossible to change the behavior, hence why he didn't do it :P.

Actually, I said something about the most obvious route being to re-use 
git_config() and that this approach had its limitations.

I also said that I earned (probably rightfully) a reputation of lousy code 
with Junio, which makes me think that I probably should refrain from ever 
contributing code to Git again.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] git config does not reuse section name
  2009-12-08  2:01   ` Johannes Schindelin
@ 2009-12-08  3:27     ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2009-12-08  3:27 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Yakup Akbay, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> IIRC, due to technical limitations, the config machinery only recognizes 
> sections if there is at least _one_ entry in them.  This is because 
> git_config() is used to determine (from the current file position) where 
> the section begins.

Ah, the reading side should be able to get by with that parsing logic, as
an empty section is totally ignorable anyway.  And the parser for the
writing side reuses that logic.  Asking for removal code to notice the
empty section and remove it needs a bit of restructuring of the parsing
logic as currently it doesn't even see an empty section.

Thanks---the explanation makes sense (I am not saying "it justifies it"; I
only mean "it explains why the code behaves like that very well").

I think we have kept the original parsing structure since repo-config
added the write support, and "fixing" the issue is not that urgent, but it
would be nice to get it fixed.  Perhaps somebody can find some time over
the upcoming holidays ;-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-08  3:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-07 17:06 [BUG] git config does not reuse section name Yakup Akbay
2009-12-07 20:04 ` Junio C Hamano
2009-12-07 20:23   ` Sverre Rabbelier
2009-12-07 20:54     ` Junio C Hamano
2009-12-08  2:05     ` Johannes Schindelin
2009-12-08  2:01   ` Johannes Schindelin
2009-12-08  3:27     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox