summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-21 18:30:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-21 18:30:11 (GMT)
commitfddf9a2d06719555fba8ce0cd09a695f012cca04 (patch)
tree70b775acec92c75ff48eb77099e8dc0d592586a5 /read-cache.c
parent649406644dc94caec3e3f2499a1786daffd90231 (diff)
parent0e267b7a240454538349407c0101cc17168cebcf (diff)
downloadgit-fddf9a2d06719555fba8ce0cd09a695f012cca04.zip
git-fddf9a2d06719555fba8ce0cd09a695f012cca04.tar.gz
git-fddf9a2d06719555fba8ce0cd09a695f012cca04.tar.bz2
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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index d05eb72..a5dc7c7 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