diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-03-21 19:30:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-21 19:30:11 +0100 |
commit | fddf9a2d06719555fba8ce0cd09a695f012cca04 (patch) | |
tree | 70b775acec92c75ff48eb77099e8dc0d592586a5 /read-cache.c | |
parent | Merge branch 'jh/fsck-promisors' (diff) | |
parent | Fix bugs preventing adding updated cache entries to the name hash (diff) | |
download | git-fddf9a2d06719555fba8ce0cd09a695f012cca04.tar.xz git-fddf9a2d06719555fba8ce0cd09a695f012cca04.zip |
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
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c index d05eb725b5..a5dc7c7e67 100644 --- a/read-cache.c +++ b/read-cache.c @@ -62,6 +62,7 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache replace_index_entry_in_base(istate, old, ce); remove_name_hash(istate, old); free(old); + ce->ce_flags &= ~CE_HASHED; set_index_entry(istate, nr, ce); ce->ce_flags |= CE_UPDATE_IN_BASE; mark_fsmonitor_invalid(istate, ce); @@ -1324,7 +1325,8 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate, size = ce_size(ce); updated = xmalloc(size); - memcpy(updated, ce, size); + copy_cache_entry(updated, ce); + memcpy(updated->name, ce->name, ce->ce_namelen + 1); fill_stat_cache_info(updated, &st); /* * If ignore_valid is not set, we should leave CE_VALID bit |