config: unify code paths to get global config paths
commit1e06eb9b5dc9c663c2a60a2ca63e218b41a765e8
authorPatrick Steinhardt <ps@pks.im>
Mon, 19 Apr 2021 12:31:12 +0000 (19 14:31 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Apr 2021 21:16:59 +0000 (19 14:16 -0700)
treed89055322ac685bdec26afbae8b5d189b5fde15d
parentc62a999c6e595692ee3bd8ff1e9435491872a79c
config: unify code paths to get global config paths

There's two callsites which assemble global config paths, once in the
config loading code and once in the git-config(1) builtin. We're about
to implement a way to override global config paths via an environment
variable which would require us to adjust both sites.

Unify both code paths into a single `git_global_config()` function which
returns both paths for `~/.gitconfig` and the XDG config file. This will
make the subsequent patch which introduces the new envvar easier to
implement.

No functional changes are expected from this patch.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/config.c
config.c
config.h