From 92e2cab96b8b8ea9a076dc279864226b3d0863e9 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 26 Apr 2021 01:02:50 +0000 Subject: Always use oidread to read into struct object_id In the future, we'll want oidread to automatically set the hash algorithm member for an object ID we read into it, so ensure we use oidread instead of hashcpy everywhere we're copying a hash value into a struct object_id. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- read-cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'read-cache.c') diff --git a/read-cache.c b/read-cache.c index 5a907af2fb..2944146545 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1845,7 +1845,7 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool, ce->ce_flags = flags & ~CE_NAMEMASK; ce->ce_namelen = len; ce->index = 0; - hashcpy(ce->oid.hash, ondisk->data); + oidread(&ce->oid, ondisk->data); memcpy(ce->name, name, len); ce->name[len] = '\0'; @@ -2195,7 +2195,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist) if (verify_hdr(hdr, mmap_size) < 0) goto unmap; - hashcpy(istate->oid.hash, (const unsigned char *)hdr + mmap_size - the_hash_algo->rawsz); + oidread(&istate->oid, (const unsigned char *)hdr + mmap_size - the_hash_algo->rawsz); istate->version = ntohl(hdr->hdr_version); istate->cache_nr = ntohl(hdr->hdr_entries); istate->cache_alloc = alloc_nr(istate->cache_nr); -- cgit v1.2.3