]> git.ipfire.org Git - thirdparty/git.git/commit
git_config_set: reuse empty sections
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 9 Apr 2018 08:32:29 +0000 (10:32 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Apr 2018 12:32:59 +0000 (21:32 +0900)
commitc71d8bb38a73abc910a63bf7a81f3869dc9c2f34
tree7af39fce0f5084545c41c94f1bca58ff5d0c67a8
parent22aedfccd0cfe7c8f09a990cf4777efc7f27bd2e
git_config_set: reuse empty sections

It can happen quite easily that the last setting in a config section is
removed, and to avoid confusion when there are comments in the config
about that section, we keep a lone section header, i.e. an empty
section.

Now that we use the `event_fn` callback, it is easy to add support for
re-using empty sections, so let's do that.

Note: t5512-ls-remote requires that this change is applied *after* the
patch "git config --unset: remove empty sections (in the common case)":
without that patch, there would be empty `transfer` and `uploadpack`
sections ready for reuse, but in the *wrong* order (and sconsequently,
t5512's "overrides work between mixed transfer/upload-pack hideRefs"
would fail).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
t/t1300-config.sh