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

git config problem with strange config files

From
Peter Oberndorfer <kumbayo84@arcor.de>
Date
Dec 31, 2007, 17:47 UTC
Message-ID
<200712311847.41499.kumbayo84@arcor.de>
Hi,

In case of a strange .git/config file "git config key value" can create a bogus config entry, where one old value is wrong and the new value resides in the wrong section until the config file is fixed up by hand

The attached test config has a trailing tab in the last line and no newline after that. When git config is run the new section name is placed directly after the trailing tab, which corrupts the old value.

To reproduce  the error do the following:

mkdir git_test_config && cd git_test_config git init <copy the attached config file to .git/config> git config section2.key bar git config --get section2.key -> returns nothing git config --get section.key -> foo [section2] -> error: More than one value for the key section.key: bar

i tried to make a test out of this but i failed to create a config file without a trailing newline using here documents :-(

Tested using v1.5.4.rc2 and v1.5.4-rc2-6-gab11903
Greetings Peter
[section]
	key = foo	
[section]
	key = foo	[section2]
	key = bar
Next: Jeff King
Message 1 of 5 in “git config problem with strange config files”
  1. Peter OberndorferDec 31, 2007
  2. Jeff KingJan 1, 2008
  3. Jeff KingJan 1, 2008
  4. Junio C HamanoJan 1, 2008
  5. Peter OberndorferJan 1, 2008

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.