mirror of
https://github.com/git/git.git
synced 2026-01-11 21:33:13 +09:00
read-cache.c: reduce unnecessary cache entry name copying
575fa8a3 (read-cache: read data in a hash-independent way, 2019-02-19) added a new code to copy from the on-disk data into the name member of the in-core cache entry, which is already done immediately after that in a way that takes prefix-compression into account. Remove this code, as it is not just unnecessary, but also can be reading beyond the on-disk data, when we are copying very long prefix string from the previous entry. Signed-off-by: ZheNing Hu <adlternative@gmail.com> [jc: rewrote the log message with Réne's findings] Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e54793a95a
commit
6d858341d2
@ -1944,8 +1944,6 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
|
||||
ce->ce_namelen = len;
|
||||
ce->index = 0;
|
||||
oidread(&ce->oid, ondisk->data);
|
||||
memcpy(ce->name, name, len);
|
||||
ce->name[len] = '\0';
|
||||
|
||||
if (expand_name_field) {
|
||||
if (copy_len)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user