From: Olamide Caleb Bello <belkid98@gmail•com>
To: git@vger•kernel.org
Cc: phillip.wood123@gmail•com, gitster@pobox•com,
christian.couder@gmail•com, usmanakinyemi202@gmail•com,
kaartic.sivaraam@gmail•com, me@ttaylorr•com,
karthik.188@gmail•com, Olamide Caleb Bello <belkid98@gmail•com>
Subject: [PATCH v2 2/8] environment: move "check_stat" into `struct repo_config_values`
Date: Tue, 24 Mar 2026 13:37:44 +0100 [thread overview]
Message-ID: <20260324123750.157143-3-belkid98@gmail.com> (raw)
In-Reply-To: <20260324123750.157143-1-belkid98@gmail.com>
The `core.checkstat` configuration is currently stored in the global
variable `check_stat`, which makes it shared across repository
instances within a single process.
Store it instead in `repo_config_values` so the value is associated
with 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().
Mentored-by: Christian Couder <christian.couder@gmail•com>
Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail•com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail•com>
---
entry.c | 3 ++-
environment.c | 6 +++---
environment.h | 2 +-
statinfo.c | 10 +++++-----
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/entry.c b/entry.c
index 7817aee362..c55e867d8a 100644
--- a/entry.c
+++ b/entry.c
@@ -443,7 +443,8 @@ static int check_path(const char *path, int len, struct stat *st, int skiplen)
static void mark_colliding_entries(const struct checkout *state,
struct cache_entry *ce, struct stat *st)
{
- int trust_ino = check_stat;
+ struct repo_config_values *cfg = repo_config_values(the_repository);
+ int trust_ino = cfg->check_stat;
#if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__)
trust_ino = 0;
diff --git a/environment.c b/environment.c
index 0a9067729e..8542ac3141 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 check_stat = 1;
int has_symlinks = 1;
int minimum_abbrev = 4, default_abbrev = -1;
int ignore_case;
@@ -315,9 +314,9 @@ int git_default_core_config(const char *var, const char *value,
if (!value)
return config_error_nonbool(var);
if (!strcasecmp(value, "default"))
- check_stat = 1;
+ cfg->check_stat = 1;
else if (!strcasecmp(value, "minimal"))
- check_stat = 0;
+ cfg->check_stat = 0;
else
return error(_("invalid value for '%s': '%s'"),
var, value);
@@ -721,4 +720,5 @@ void repo_config_values_init(struct repo_config_values *cfg)
cfg->apply_sparse_checkout = 0;
cfg->branch_track = BRANCH_TRACK_REMOTE;
cfg->trust_ctime = 1;
+ cfg->check_stat = 1;
}
diff --git a/environment.h b/environment.h
index 64d537686e..1d3e2e4f23 100644
--- a/environment.h
+++ b/environment.h
@@ -92,6 +92,7 @@ struct repo_config_values {
char *attributes_file;
int apply_sparse_checkout;
int trust_ctime;
+ int check_stat;
/* section "branch" config values */
enum branch_track branch_track;
@@ -162,7 +163,6 @@ extern char *git_work_tree_cfg;
/* Environment bits from configuration mechanism */
extern int trust_executable_bit;
-extern int check_stat;
extern int has_symlinks;
extern int minimum_abbrev, default_abbrev;
extern int ignore_case;
diff --git a/statinfo.c b/statinfo.c
index 4fc12053f4..5e00af127d 100644
--- a/statinfo.c
+++ b/statinfo.c
@@ -68,19 +68,19 @@ int match_stat_data(const struct stat_data *sd, struct stat *st)
if (sd->sd_mtime.sec != (unsigned int)st->st_mtime)
changed |= MTIME_CHANGED;
- if (cfg->trust_ctime && check_stat &&
+ if (cfg->trust_ctime && cfg->check_stat &&
sd->sd_ctime.sec != (unsigned int)st->st_ctime)
changed |= CTIME_CHANGED;
#ifdef USE_NSEC
- if (check_stat && sd->sd_mtime.nsec != ST_MTIME_NSEC(*st))
+ if (cfg->check_stat && sd->sd_mtime.nsec != ST_MTIME_NSEC(*st))
changed |= MTIME_CHANGED;
- if (cfg->trust_ctime && check_stat &&
+ if (cfg->trust_ctime && cfg->check_stat &&
sd->sd_ctime.nsec != ST_CTIME_NSEC(*st))
changed |= CTIME_CHANGED;
#endif
- if (check_stat) {
+ if (cfg->check_stat) {
if (sd->sd_uid != (unsigned int) st->st_uid ||
sd->sd_gid != (unsigned int) st->st_gid)
changed |= OWNER_CHANGED;
@@ -94,7 +94,7 @@ int match_stat_data(const struct stat_data *sd, struct stat *st)
* clients will have different views of what "device"
* the filesystem is on
*/
- if (check_stat && sd->sd_dev != (unsigned int) st->st_dev)
+ if (cfg->check_stat && sd->sd_dev != (unsigned int) st->st_dev)
changed |= INODE_CHANGED;
#endif
--
2.53.0.155.g9f36b15afa
next prev parent reply other threads:[~2026-03-24 12:39 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 12:37 [PATCH v2 0/8] repo_config_values: migrate more globals Olamide Caleb Bello
2026-03-24 12:37 ` [PATCH v2 1/8] environment: move "trust_ctime" into `struct repo_config_values` Olamide Caleb Bello
2026-04-14 8:52 ` Karthik Nayak
2026-04-14 9:35 ` Phillip Wood
2026-04-14 17:15 ` Junio C Hamano
2026-04-15 11:16 ` Karthik Nayak
2026-04-15 15:49 ` Junio C Hamano
2026-04-15 19:09 ` Karthik Nayak
2026-03-24 12:37 ` Olamide Caleb Bello [this message]
2026-04-14 8:55 ` [PATCH v2 2/8] environment: move "check_stat" " Karthik Nayak
2026-03-24 12:37 ` [PATCH v2 3/8] environment: move `zlib_compression_level` into repo_config_values Olamide Caleb Bello
2026-04-14 8:58 ` Karthik Nayak
2026-04-14 14:32 ` Bello Olamide
2026-03-24 12:37 ` [PATCH v2 4/8] environment: move "pack_compression_level" into `struct repo_config_values` Olamide Caleb Bello
2026-03-24 12:37 ` [PATCH v2 5/8] environment: move "precomposed_unicode" " Olamide Caleb Bello
2026-04-14 9:07 ` Karthik Nayak
2026-03-24 12:37 ` [PATCH v2 6/8] env: move "core_sparse_checkout_cone" " Olamide Caleb Bello
2026-03-24 12:37 ` [PATCH v2 7/8] env: put "sparse_expect_files_outside_of_patterns" in `repo_config_values` Olamide Caleb Bello
2026-03-24 12:37 ` [PATCH v2 8/8] env: move "warn_on_object_refname_ambiguity" into `repo_config_values` Olamide Caleb Bello
2026-04-14 9:10 ` [PATCH v2 0/8] repo_config_values: migrate more globals Karthik Nayak
2026-04-14 14:26 ` Bello Olamide
2026-04-23 16:08 ` [PATCH v3 " Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 1/8] Revert "compat/posix: introduce writev(3p) wrapper" Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 2/8] rust: we are way beyond 2.53 Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 3/8] doc: am: revert Message-ID trailer claim Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 4/8] doc: am: correct to full --no-message-id Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 5/8] CI: bump actions/checkout from 4 to 5 for rust-analysis job Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 6/8] gitglossary: fix indentation of sub-lists Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 7/8] Hopefully the final tweak before -rc2 Olamide Caleb Bello
2026-04-23 16:08 ` [PATCH v3 8/8] Git 2.54-rc2 Olamide Caleb Bello
2026-04-23 16:37 ` [PATCH v3 0/8] repo_config_values: migrate more globals Bello Olamide
2026-06-01 15:42 ` [PATCH v4 " Olamide Caleb Bello
2026-06-01 15:42 ` [PATCH v4 1/8] environment: move "trust_ctime" into `struct repo_config_values` Olamide Caleb Bello
2026-06-01 15:42 ` [PATCH v4 2/8] environment: move "check_stat" " Olamide Caleb Bello
2026-06-01 15:42 ` [PATCH v4 3/8] environment: move `zlib_compression_level` " Olamide Caleb Bello
2026-06-02 0:07 ` Junio C Hamano
2026-06-02 8:12 ` Patrick Steinhardt
2026-06-02 10:08 ` Christian Couder
2026-06-02 10:26 ` Junio C Hamano
2026-06-01 15:42 ` [PATCH v4 4/8] environment: move "pack_compression_level" " Olamide Caleb Bello
2026-06-01 15:42 ` [PATCH v4 5/8] environment: move "precomposed_unicode" " Olamide Caleb Bello
2026-06-01 23:54 ` Junio C Hamano
2026-06-01 15:42 ` [PATCH v4 6/8] environment: move "core_sparse_checkout_cone" " Olamide Caleb Bello
2026-06-01 15:42 ` [PATCH v4 7/8] environment: move "sparse_expect_files_outside_of_patterns" into `repo_config_values` Olamide Caleb Bello
2026-06-01 15:42 ` [PATCH v4 8/8] environment: move "warn_on_object_refname_ambiguity" into `struct repo_config_values` Olamide Caleb Bello
2026-06-02 0:05 ` Junio C Hamano
2026-06-02 17:09 ` [PATCH v5 0/8] repo_config_values: migrate more globals variables Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 1/8] environment: move "trust_ctime" into `struct repo_config_values` Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 2/8] environment: move "check_stat" " Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 3/8] environment: move `zlib_compression_level` " Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 4/8] environment: move "pack_compression_level" " Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 5/8] environment: move "precomposed_unicode" " Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 6/8] environment: move "core_sparse_checkout_cone" " Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 7/8] environment: move "sparse_expect_files_outside_of_patterns" " Olamide Caleb Bello
2026-06-02 17:09 ` [PATCH v5 8/8] environment: move "warn_on_object_refname_ambiguity" " Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 0/8] environment: move core config globals into repo_config_values Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 1/8] environment: move "trust_ctime" into `struct repo_config_values` Olamide Caleb Bello
2026-05-21 16:37 ` Tian Yuchen
2026-06-01 14:01 ` Bello Olamide
2026-04-23 16:54 ` [PATCH v3 2/8] environment: move "check_stat" " Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 3/8] environment: move `zlib_compression_level` " Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 4/8] environment: move "pack_compression_level" " Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 5/8] environment: move "precomposed_unicode" " Olamide Caleb Bello
2026-05-15 17:15 ` Tian Yuchen
2026-04-23 16:54 ` [PATCH v3 6/8] env: move "core_sparse_checkout_cone" " Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 7/8] env: move "sparse_expect_files_outside_of_patterns" into `repo_config_values` Olamide Caleb Bello
2026-04-23 16:54 ` [PATCH v3 8/8] env: move "warn_on_object_refname_ambiguity" into `struct repo_config_values` Olamide Caleb Bello
2026-04-26 0:01 ` [PATCH v3 0/8] environment: move core config globals into repo_config_values Junio C Hamano
2026-04-26 0:31 ` Bello Olamide
2026-05-11 2:56 ` Junio C Hamano
2026-06-01 21:43 ` Junio C Hamano
2026-06-01 22:24 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260324123750.157143-3-belkid98@gmail.com \
--to=belkid98@gmail$(echo .)com \
--cc=christian.couder@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=kaartic.sivaraam@gmail$(echo .)com \
--cc=karthik.188@gmail$(echo .)com \
--cc=me@ttaylorr$(echo .)com \
--cc=phillip.wood123@gmail$(echo .)com \
--cc=usmanakinyemi202@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox