From: Karthik Nayak Date: Tue, 14 Apr 2026 08:52:54 GMT Subject: Re: [PATCH v2 1/8] environment: move "trust_ctime" into `struct repo_config_values` Message-ID: In-Reply-To: <20260324123750.157143-2-belkid98@gmail.com> Olamide Caleb Bello writes: > The `core.trustctime` configuration is currently stored in the global > variable `trust_ctime`, which makes it shared across repository > instances in a single process. > > Store it instead in `repo_config_values`, so the value is tied to the > repository from which it was read. This preserves existing behavior > while avoiding cross-repository state leakage and continues the effort > to reduce reliance on global configuration state. > > Update all references to use repo_config_values(). > Nit: I was hoping you'd also shed light on why this can go into `repo_config_values()`. Does it need to be eagerly parsed? If so, why? > Mentored-by: Christian Couder > Mentored-by: Usman Akinyemi > Signed-off-by: Olamide Caleb Bello > --- > environment.c | 4 ++-- > environment.h | 2 +- > statinfo.c | 6 ++++-- > 3 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/environment.c b/environment.c > index fc3ed8bb1c..0a9067729e 100644 > --- a/environment.c > +++ b/environment.c > @@ -42,7 +42,6 @@ static int pack_compression_seen; > static int zlib_compression_seen; > > int trust_executable_bit = 1; > -int trust_ctime = 1; > int check_stat = 1; > int has_symlinks = 1; > int minimum_abbrev = 4, default_abbrev = -1; > @@ -309,7 +308,7 @@ int git_default_core_config(const char *var, const char *value, > return 0; > } > if (!strcmp(var, "core.trustctime")) { > - trust_ctime = git_config_bool(var, value); > + cfg->trust_ctime = git_config_bool(var, value); > return 0; > } > if (!strcmp(var, "core.checkstat")) { > @@ -721,4 +720,5 @@ void repo_config_values_init(struct repo_config_values *cfg) > cfg->attributes_file = NULL; > cfg->apply_sparse_checkout = 0; > cfg->branch_track = BRANCH_TRACK_REMOTE; > + cfg->trust_ctime = 1; > } > diff --git a/environment.h b/environment.h > index 123a71cdc8..64d537686e 100644 > --- a/environment.h > +++ b/environment.h > @@ -91,6 +91,7 @@ struct repo_config_values { > /* section "core" config values */ > char *attributes_file; > int apply_sparse_checkout; > + int trust_ctime; > Since we parse it as a bool, perhaps we can make the variable to be of type bool? [snip]