summaryrefslogtreecommitdiff
path: root/streaming.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-24 15:46:41 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-24 15:46:41 -0800
commita545103244a712fd6a96dd2020fe91c0c8f6fdce (patch)
tree89589f27eecd38c60e27608e2ac087c049210cc3 /streaming.c
parent05ce3ab2c6898c7694a5cc198f8b3fd931611578 (diff)
parent3e5e360888316ed1a44da69bf134bb6ec70aee1b (diff)
Merge branch 'ps/object-source-loose'
A part of code paths that deals with loose objects has been cleaned up. * ps/object-source-loose: object-file: refactor writing objects via a stream object-file: rename `write_object_file()` object-file: refactor freshening of objects object-file: rename `has_loose_object()` object-file: read objects via the loose object source object-file: move loose object map into loose source object-file: hide internals when we need to reprepare loose sources object-file: move loose object cache into loose source object-file: introduce `struct odb_source_loose` object-file: move `fetch_if_missing` odb: adjust naming to free object sources odb: introduce `odb_source_new()` odb: fix subtle logic to check whether an alternate is usable
Diffstat (limited to 'streaming.c')
-rw-r--r--streaming.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/streaming.c b/streaming.c
index 4b13827668..00ad649ae3 100644
--- a/streaming.c
+++ b/streaming.c
@@ -230,12 +230,21 @@ static int open_istream_loose(struct git_istream *st, struct repository *r,
enum object_type *type)
{
struct object_info oi = OBJECT_INFO_INIT;
+ struct odb_source *source;
+
oi.sizep = &st->size;
oi.typep = type;
- st->u.loose.mapped = map_loose_object(r, oid, &st->u.loose.mapsize);
+ odb_prepare_alternates(r->objects);
+ for (source = r->objects->sources; source; source = source->next) {
+ st->u.loose.mapped = odb_source_loose_map_object(source, oid,
+ &st->u.loose.mapsize);
+ if (st->u.loose.mapped)
+ break;
+ }
if (!st->u.loose.mapped)
return -1;
+
switch (unpack_loose_header(&st->z, st->u.loose.mapped,
st->u.loose.mapsize, st->u.loose.hdr,
sizeof(st->u.loose.hdr))) {