diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-12-30 12:58:21 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-12-30 12:58:22 +0900 |
| commit | e7b1925381123cea4a8817054f7d41bc6568de86 (patch) | |
| tree | c9eb93fa6f1cece490d01a4e6ba8713be93b437c /odb.c | |
| parent | a194cdc8f3c8d74a22c6342a915b1f7587277152 (diff) | |
| parent | a650ad996db85b64643970dd7dc5920f989260a0 (diff) | |
| download | git-e7b1925381123cea4a8817054f7d41bc6568de86.tar.xz | |
Merge branch 'jc/object-read-stream-fix'
Fix a performance regression in recently graduated topic.
* jc/object-read-stream-fix:
odb: do not use "blank" substitute for NULL
Diffstat (limited to 'odb.c')
| -rw-r--r-- | odb.c | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -677,34 +677,31 @@ static int do_oid_object_info_extended(struct object_database *odb, const struct object_id *oid, struct object_info *oi, unsigned flags) { - static struct object_info blank_oi = OBJECT_INFO_INIT; const struct cached_object *co; const struct object_id *real = oid; int already_retried = 0; - if (flags & OBJECT_INFO_LOOKUP_REPLACE) real = lookup_replace_object(odb->repo, oid); if (is_null_oid(real)) return -1; - if (!oi) - oi = &blank_oi; - co = find_cached_object(odb, real); if (co) { - if (oi->typep) - *(oi->typep) = co->type; - if (oi->sizep) - *(oi->sizep) = co->size; - if (oi->disk_sizep) - *(oi->disk_sizep) = 0; - if (oi->delta_base_oid) - oidclr(oi->delta_base_oid, odb->repo->hash_algo); - if (oi->contentp) - *oi->contentp = xmemdupz(co->buf, co->size); - oi->whence = OI_CACHED; + if (oi) { + if (oi->typep) + *(oi->typep) = co->type; + if (oi->sizep) + *(oi->sizep) = co->size; + if (oi->disk_sizep) + *(oi->disk_sizep) = 0; + if (oi->delta_base_oid) + oidclr(oi->delta_base_oid, odb->repo->hash_algo); + if (oi->contentp) + *oi->contentp = xmemdupz(co->buf, co->size); + oi->whence = OI_CACHED; + } return 0; } |
