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

Re: [BUG] git config does not reuse section name

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 8, 2009, 02:01 UTC
Message-ID
<alpine.DEB.1.00.0912080258010.4985@pacific.mpi-cbg.de>
In-Reply-To
<7vy6le35zv.fsf@alter.siamese.dyndns.org>
Hi,
On Mon, 7 Dec 2009, Junio C Hamano wrote:
Show 26 quoted lines
> 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

Previous: Johannes SchindelinNext: Junio C Hamano
Message 6 of 7 in “[BUG] git config does not reuse section name”
  1. Yakup AkbayDec 7, 2009
  2. Junio C HamanoDec 7, 2009
  3. Sverre RabbelierDec 7, 2009
  4. Junio C HamanoDec 7, 2009
  5. Johannes SchindelinDec 8, 2009
  6. Johannes SchindelinDec 8, 2009
  7. Junio C HamanoDec 8, 2009

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.