{"thread":{"id":"66640","subject":"[PATCH] config: move core.ignorestat into repo config","startedAt":"2026-10-23T11:31:29Z","lastAt":"2026-10-23T11:31:29Z","messageCount":1,"participants":["Joy via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"555983","messageId":"pull.2278.git.1792755089871.gitgitgadget@gmail.com","threadId":"66640","inReplyTo":null,"subject":"[PATCH] config: move core.ignorestat into repo config","fromName":"Joy via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-23T11:31:29Z","receivedAt":"2026-10-23T11:31:29Z","isPatch":true,"sender":{"key":"cryptocurrencydiva@gmail.com","avatar":null},"body":"From: Joy Gundu <soniqjjj@gmail.com>\n\nThe core.ignorestat setting is currently stored in the standalone\nassume_unchanged global variable. This makes the configuration state\nharder to encapsulate as Git moves towards being usable as a library.\n\nStore the setting in struct repo_config_values instead and update its\nconsumers to read the value through repo_config_values(). This removes\nanother standalone global while preserving the existing behavior.\n\nAdd a test covering the effect of core.ignorestat on updated paths.\n\nSigned-off-by: Joy Gundu <soniqjjj@gmail.com>\n---\n    config: move core.ignorestat into repo config\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2278%2FJoiejoie1%2Foutreachy%2Fassume-unchanged-config-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2278/Joiejoie1/outreachy/assume-unchanged-config-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2278\n\n builtin/update-index.c                   | 2 +-\n environment.c                            | 3 +--\n environment.h                            | 3 +--\n read-cache.c                             | 8 +++++---\n t/t2106-update-index-assume-unchanged.sh | 9 +++++++++\n 5 files changed, 17 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex 018b78d6bb..59412770ca 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -431,7 +431,7 @@ static int add_cacheinfo(unsigned int mode, const struct object_id *oid,\n \tce->ce_flags = create_ce_flags(stage);\n \tce->ce_namelen = len;\n \tce->ce_mode = create_ce_mode(mode);\n-\tif (assume_unchanged)\n+\tif (repo_config_values(the_repository)->assume_unchanged)\n \t\tce->ce_flags |= CE_VALID;\n \toption = allow_add ? ADD_CACHE_OK_TO_ADD : 0;\n \toption |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;\ndiff --git a/environment.c b/environment.c\nindex c83cf44839..f19aa07f7e 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -42,7 +42,6 @@ static int pack_compression_seen;\n static int zlib_compression_seen;\n \n int minimum_abbrev = 4, default_abbrev = -1;\n-int assume_unchanged;\n char *git_commit_encoding;\n char *git_log_output_encoding;\n int fsync_object_files = -1;\n@@ -371,7 +370,7 @@ int git_default_core_config(const char *var, const char *value,\n \t}\n \n \tif (!strcmp(var, \"core.ignorestat\")) {\n-\t\tassume_unchanged = git_config_bool(var, value);\n+\t\tcfg->assume_unchanged = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n \ndiff --git a/environment.h b/environment.h\nindex 49c86e8879..443a962a6a 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -146,6 +146,7 @@ struct repo_config_values {\n \tint protect_hfs;\n \tint protect_ntfs;\n \tint ignore_case;\n+\tint assume_unchanged;\n \tint trust_executable_bit;\n \tint has_symlinks;\n \tint use_nanosec;\n@@ -242,9 +243,7 @@ int have_git_dir(void);\n \n /* Environment bits from configuration mechanism */\n extern int minimum_abbrev, default_abbrev;\n-extern int assume_unchanged;\n extern unsigned long pack_size_limit_cfg;\n-\n extern int grafts_keep_true_parents;\n \n const char *get_log_output_encoding(void);\ndiff --git a/read-cache.c b/read-cache.c\nindex c4cf08a3a3..a1430fc427 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -194,7 +194,7 @@ void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, st\n {\n \tfill_stat_data(&ce->ce_stat_data, st);\n \n-\tif (assume_unchanged)\n+\tif (repo_config_values(the_repository)->assume_unchanged)\n \t\tce->ce_flags |= CE_VALID;\n \n \tif (S_ISREG(st->st_mode)) {\n@@ -1415,7 +1415,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,\n \t\t * is not marked VALID, this is the place to mark it\n \t\t * valid again, under \"assume unchanged\" mode.\n \t\t */\n-\t\tif (ignore_valid && assume_unchanged &&\n+\t\tif (ignore_valid &&\n+\t\t    repo_config_values(the_repository)->assume_unchanged &&\n \t\t    !(ce->ce_flags & CE_VALID))\n \t\t\t; /* mark this one VALID again */\n \t\telse {\n@@ -1450,7 +1451,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,\n \t * (i.e. things to be edited) will reacquire CE_VALID bit\n \t * automatically, which is not really what we want.\n \t */\n-\tif (!ignore_valid && assume_unchanged &&\n+\tif (!ignore_valid &&\n+\t    repo_config_values(the_repository)->assume_unchanged &&\n \t    !(ce->ce_flags & CE_VALID))\n \t\tupdated->ce_flags &= ~CE_VALID;\n \ndiff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh\nindex 6b2ccc21a9..9b83fe197c 100755\n--- a/t/t2106-update-index-assume-unchanged.sh\n+++ b/t/t2106-update-index-assume-unchanged.sh\n@@ -24,4 +24,13 @@ test_expect_success 'do not switch branches with dirty file' '\n \ttest_grep overwritten err\n '\n \n+test_expect_success 'core.ignorestat marks updated paths assume-unchanged' '\n+\tgit reset --hard &&\n+\tgit update-index --no-assume-unchanged file &&\n+\ttest_config core.ignorestat true &&\n+\techo changed >file &&\n+\tgit update-index file &&\n+\ttest \"$(git ls-files -v file)\" = \"h file\"\n+'\n+\n test_done\n\nbase-commit: 7e34d8174dcda3435d1404c9a30bef46afe6c13e\n-- \ngitgitgadget\n\n"}]}