git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] config: move core.ignorestat into repo config

From
JGJoy via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 23, 2026, 11:31 UTC
Message-ID
<pull.2278.git.1792755089871.gitgitgadget@gmail.com>
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
Message 1 of 1 in “config: move core.ignorestat into repo config”
  1. config: move core.ignorestat into repo configJoy via GitGitGadget, Oct 23, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.