Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builtin/update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down
9 changes: 9 additions & 0 deletions t/t2106-update-index-assume-unchanged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading