* [PATCH] config: move core.ignorestat into repo config
@ 2026-10-23 11:31 Joy via GitGitGadget
0 siblings, 0 replies; only message in thread
From: Joy via GitGitGadget @ 2026-10-23 11:31 UTC (permalink / raw)
To: git; +Cc: Joy, Joy Gundu
From: Joy Gundu <soniqjjj@gmail.com>
The core.ignorestat setting is currently stored in the standalone
assume_unchanged global variable. This makes the configuration state
harder to encapsulate as Git moves towards being usable as a library.
Store the setting in struct repo_config_values instead and update its
consumers to read the value through repo_config_values(). This removes
another standalone global while preserving the existing behavior.
Add a test covering the effect of core.ignorestat on updated paths.
Signed-off-by: Joy Gundu <soniqjjj@gmail.com>
---
config: move core.ignorestat into repo config
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2278%2FJoiejoie1%2Foutreachy%2Fassume-unchanged-config-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2278/Joiejoie1/outreachy/assume-unchanged-config-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2278
builtin/update-index.c | 2 +-
environment.c | 3 +--
environment.h | 3 +--
read-cache.c | 8 +++++---
t/t2106-update-index-assume-unchanged.sh | 9 +++++++++
5 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 018b78d6bb..59412770ca 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -431,7 +431,7 @@ static int add_cacheinfo(unsigned int mode, const struct object_id *oid,
ce->ce_flags = create_ce_flags(stage);
ce->ce_namelen = len;
ce->ce_mode = create_ce_mode(mode);
- if (assume_unchanged)
+ if (repo_config_values(the_repository)->assume_unchanged)
ce->ce_flags |= CE_VALID;
option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
diff --git a/environment.c b/environment.c
index c83cf44839..f19aa07f7e 100644
--- a/environment.c
+++ b/environment.c
@@ -42,7 +42,6 @@ static int pack_compression_seen;
static int zlib_compression_seen;
int minimum_abbrev = 4, default_abbrev = -1;
-int assume_unchanged;
char *git_commit_encoding;
char *git_log_output_encoding;
int fsync_object_files = -1;
@@ -371,7 +370,7 @@ int git_default_core_config(const char *var, const char *value,
}
if (!strcmp(var, "core.ignorestat")) {
- assume_unchanged = git_config_bool(var, value);
+ cfg->assume_unchanged = git_config_bool(var, value);
return 0;
}
diff --git a/environment.h b/environment.h
index 49c86e8879..443a962a6a 100644
--- a/environment.h
+++ b/environment.h
@@ -146,6 +146,7 @@ struct repo_config_values {
int protect_hfs;
int protect_ntfs;
int ignore_case;
+ int assume_unchanged;
int trust_executable_bit;
int has_symlinks;
int use_nanosec;
@@ -242,9 +243,7 @@ int have_git_dir(void);
/* Environment bits from configuration mechanism */
extern int minimum_abbrev, default_abbrev;
-extern int assume_unchanged;
extern unsigned long pack_size_limit_cfg;
-
extern int grafts_keep_true_parents;
const char *get_log_output_encoding(void);
diff --git a/read-cache.c b/read-cache.c
index c4cf08a3a3..a1430fc427 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -194,7 +194,7 @@ void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, st
{
fill_stat_data(&ce->ce_stat_data, st);
- if (assume_unchanged)
+ if (repo_config_values(the_repository)->assume_unchanged)
ce->ce_flags |= CE_VALID;
if (S_ISREG(st->st_mode)) {
@@ -1415,7 +1415,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
* is not marked VALID, this is the place to mark it
* valid again, under "assume unchanged" mode.
*/
- if (ignore_valid && assume_unchanged &&
+ if (ignore_valid &&
+ repo_config_values(the_repository)->assume_unchanged &&
!(ce->ce_flags & CE_VALID))
; /* mark this one VALID again */
else {
@@ -1450,7 +1451,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
* (i.e. things to be edited) will reacquire CE_VALID bit
* automatically, which is not really what we want.
*/
- if (!ignore_valid && assume_unchanged &&
+ if (!ignore_valid &&
+ repo_config_values(the_repository)->assume_unchanged &&
!(ce->ce_flags & CE_VALID))
updated->ce_flags &= ~CE_VALID;
diff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh
index 6b2ccc21a9..9b83fe197c 100755
--- a/t/t2106-update-index-assume-unchanged.sh
+++ b/t/t2106-update-index-assume-unchanged.sh
@@ -24,4 +24,13 @@ test_expect_success 'do not switch branches with dirty file' '
test_grep overwritten err
'
+test_expect_success 'core.ignorestat marks updated paths assume-unchanged' '
+ git reset --hard &&
+ git update-index --no-assume-unchanged file &&
+ test_config core.ignorestat true &&
+ echo changed >file &&
+ git update-index file &&
+ test "$(git ls-files -v file)" = "h file"
+'
+
test_done
base-commit: 7e34d8174dcda3435d1404c9a30bef46afe6c13e
--
gitgitgadget
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 11:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 11:31 [PATCH] config: move core.ignorestat into repo config Joy via GitGitGadget
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.