]> git.ipfire.org Git - thirdparty/git.git/commit
config: move Git config parsing into "environment.c"
authorPatrick Steinhardt <ps@pks.im>
Wed, 23 Jul 2025 14:08:41 +0000 (16:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Jul 2025 15:15:22 +0000 (08:15 -0700)
commit08b775864edf96b97500fd70446c55528f5cf4a6
treee4dc1ca285ebd6aa9d3c602e1fa4b4389207d11e
parent00271bb3001fd8732d8afc746f2188f807192e87
config: move Git config parsing into "environment.c"

In "config.c" we host both the business logic to read and write config
files as well as the logic to parse specific Git-related variables. On
the one hand this is mixing concerns, but even more importantly it means
that we cannot easily remove the dependency on `the_repository` in our
config parsing logic.

Move the logic into "environment.c". This file is a grab bag of all
kinds of global state already, so it is quite a good fit. Furthermore,
it also hosts most of the global variables that we're parsing the config
values into, making this an even better fit.

Note that there is one hidden change: in `parse_fsync_components()` we
use an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But
as -Wsign-compare warnings are enabled in this file this causes a
compiler warning. The issue is fixed by using a `size_t` instead.

This change allows us to drop the `USE_THE_REPOSITORY_VARIABLE`
declaration.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
55 files changed:
builtin/add.c
builtin/check-ignore.c
builtin/check-mailmap.c
builtin/checkout--worker.c
builtin/checkout-index.c
builtin/clean.c
builtin/commit-graph.c
builtin/commit-tree.c
builtin/count-objects.c
builtin/credential.c
builtin/fast-export.c
builtin/for-each-ref.c
builtin/fsmonitor--daemon.c
builtin/grep.c
builtin/hash-object.c
builtin/help.c
builtin/hook.c
builtin/interpret-trailers.c
builtin/ls-files.c
builtin/ls-tree.c
builtin/merge-base.c
builtin/merge-tree.c
builtin/multi-pack-index.c
builtin/pack-refs.c
builtin/patch-id.c
builtin/pull.c
builtin/read-tree.c
builtin/replace.c
builtin/rm.c
builtin/send-pack.c
builtin/show-ref.c
builtin/symbolic-ref.c
builtin/unpack-file.c
builtin/update-ref.c
builtin/update-server-info.c
builtin/var.c
builtin/verify-commit.c
builtin/verify-pack.c
builtin/verify-tag.c
builtin/write-tree.c
commit-graph.c
config.c
config.h
environment.c
environment.h
fsck.c
http-fetch.c
http.c
imap-send.c
mailinfo.c
reflog.c
rerere.c
t/helper/test-advise.c
t/helper/test-read-cache.c
xdiff-interface.c