Skip to content

Commit fddf9a2

Browse files
committed
Merge branch 'bp/refresh-cache-ent-rehash-fix'
The codepath to replace an existing entry in the index had a bug in updating the name hash structure, which has been fixed. * bp/refresh-cache-ent-rehash-fix: Fix bugs preventing adding updated cache entries to the name hash
2 parents 6494066 + 0e267b7 commit fddf9a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

read-cache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
6262
replace_index_entry_in_base(istate, old, ce);
6363
remove_name_hash(istate, old);
6464
free(old);
65+
ce->ce_flags &= ~CE_HASHED;
6566
set_index_entry(istate, nr, ce);
6667
ce->ce_flags |= CE_UPDATE_IN_BASE;
6768
mark_fsmonitor_invalid(istate, ce);
@@ -1324,7 +1325,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
13241325

13251326
size = ce_size(ce);
13261327
updated = xmalloc(size);
1327-
memcpy(updated, ce, size);
1328+
copy_cache_entry(updated, ce);
1329+
memcpy(updated->name, ce->name, ce->ce_namelen + 1);
13281330
fill_stat_cache_info(updated, &st);
13291331
/*
13301332
* If ignore_valid is not set, we should leave CE_VALID bit

0 commit comments

Comments
 (0)