]> git.ipfire.org Git - thirdparty/git.git/commit
environment: move access to "core.bigFileThreshold" into repo settings
authorPatrick Steinhardt <ps@pks.im>
Mon, 10 Mar 2025 07:13:23 +0000 (08:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Mar 2025 20:16:18 +0000 (13:16 -0700)
commit7835ee75cdffbce925246cbacc83e8b4a932a681
treee5cde73d564e23c1d5980514c2065d4bd3c50d3b
parent2582846f2fe21b23fe7c567e030510960f135160
environment: move access to "core.bigFileThreshold" into repo settings

The "core.bigFileThreshold" setting is stored in a global variable and
populated via `git_default_core_config()`. This may cause issues in
the case where one is handling multiple different repositories in a
single process with different values for that config key, as we may or
may not see the correct value in that case. Furthermore, global state
blocks our path towards libification.

Refactor the code so that we instead store the value in `struct
repo_settings`, where the value is computed as-needed and cached.

Note that this change requires us to adapt one test in t1050 that
verifies that we die when parsing an invalid "core.bigFileThreshold"
value. The exercised Git command doesn't use the value at all, and thus
it won't hit the new code path that parses the value. This is addressed
by using git-hash-object(1) instead, which does read the value.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 files changed:
archive.c
builtin/fast-import.c
builtin/index-pack.c
builtin/pack-objects.c
builtin/unpack-objects.c
config.c
diff.c
environment.c
environment.h
object-file.c
pack-check.c
repo-settings.c
repo-settings.h
streaming.c
t/t1050-large.sh