git config oddity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Heya,

I noticed today that when unsetting the last value in a group git
config leaves the empty group header. I was somewhat surprised here,
but I am guessing it has a purpose? Anyway, I also noticed (and this
threw my manual config parser off) that when later on an option is set
to that empty group, a new group is created with the same name. Is
this something I have to deal with in my parser (e.g., should I keep
scanning the file for occurrences of my header and allow for empty
groups, or is this a bug in git config? Either is fine with me, was
just wondering :).

-----------------
sverre@Laptop-Sverre:~/code$ mkdir config-oddity
sverre@Laptop-Sverre:~/code$ cd config-oddity/
sverre@Laptop-Sverre:~/code/config-oddity$ git init
Initialized empty Git repository in /home/sverre/code/config-oddity/.git/
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
sverre@Laptop-Sverre:~/code/config-oddity$ git config foo.bar spam
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config # as expected
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[foo]
	bar = spam
sverre@Laptop-Sverre:~/code/config-oddity$ git config --unset foo.bar
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config # dubious,
but acceptable
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[foo]
sverre@Laptop-Sverre:~/code/config-oddity$ git config foo.bar eggs
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config # errr? two
[foo] headers?
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[foo]
[foo]
	bar = eggs
sverre@Laptop-Sverre:~/code/config-oddity$
-----------------

-- 
Cheers,

Sverre Rabbelier
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux