summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorBen Peart <benpeart@microsoft.com>2018-03-15 15:25:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-15 17:58:30 (GMT)
commit0e267b7a240454538349407c0101cc17168cebcf (patch)
tree5e46d2d9bfb91b4a52510ca20992c4787dfe16a5 /read-cache.c
parent38e79b1fdab9244e1727d0698afcf3bb8956c0a4 (diff)
downloadgit-0e267b7a240454538349407c0101cc17168cebcf.zip
git-0e267b7a240454538349407c0101cc17168cebcf.tar.gz
git-0e267b7a240454538349407c0101cc17168cebcf.tar.bz2
Fix bugs preventing adding updated cache entries to the name hash
Update replace_index_entry() to clear the CE_HASHED flag from the new cache entry so that it can add it to the name hash in set_index_entry() Fix refresh_cache_ent() to use the copy_cache_entry() macro instead of memcpy() so that it doesn't incorrectly copy the hash state from the old entry. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 2eb81a6..96fa833 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);
@@ -1325,7 +1326,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