summaryrefslogtreecommitdiffstats
path: root/refs/files-backend.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-12 13:30:18 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-12 19:15:43 +0200
commiteafb126456b235c5281e3ae50bfd526552ce12d3 (patch)
tree24fc4c55c9306970a9336196ba3a32d0cc9e1cea /refs/files-backend.c
parentrefs: stop modifying global `log_all_ref_updates` variable (diff)
downloadgit-eafb126456b235c5281e3ae50bfd526552ce12d3.tar.xz
git-eafb126456b235c5281e3ae50bfd526552ce12d3.zip
environment: stop storing "core.logAllRefUpdates" globally
The value of "core.logAllRefUpdates" is being stored in the global variable `log_all_ref_updates`. This design is somewhat aged nowadays, where it is entirely possible to access multiple repositories in the same process which all have different values for this setting. So using a single global variable to track it is plain wrong. Remove the global variable. Instead, we now provide a new function part of the repo-settings subsystem that parses the value for a specific repository. While that may require us to read the value multiple times, we work around this by reading it once when the ref backends are set up and caching the value there. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--refs/files-backend.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index f5871abcf7..a536d7d1b5 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -75,6 +75,7 @@ struct files_ref_store {
unsigned int store_flags;
char *gitcommondir;
+ enum log_refs_config log_all_ref_updates;
struct ref_cache *loose;
@@ -107,6 +108,7 @@ static struct ref_store *files_ref_store_init(struct repository *repo,
refs->gitcommondir = strbuf_detach(&sb, NULL);
refs->packed_ref_store =
packed_ref_store_init(repo, refs->gitcommondir, flags);
+ refs->log_all_ref_updates = repo_settings_get_log_all_ref_updates(repo);
chdir_notify_reparent("files-backend $GIT_DIR", &refs->base.gitdir);
chdir_notify_reparent("files-backend $GIT_COMMONDIR",
@@ -1704,7 +1706,7 @@ static int log_ref_setup(struct files_ref_store *refs,
const char *refname, int force_create,
int *logfd, struct strbuf *err)
{
- enum log_refs_config log_refs_cfg = log_all_ref_updates;
+ enum log_refs_config log_refs_cfg = refs->log_all_ref_updates;
struct strbuf logfile_sb = STRBUF_INIT;
char *logfile;