From: Junio C Hamano Date: Mon, 09 Feb 2026 11:15:51 GMT Subject: Re: [PATCH] xdiff-interface: stop using the_repository Message-ID: In-Reply-To: René Scharfe writes: > Use the algorithm-agnostic is_null_oid() and push the dependency of > read_mmblob() on the_repository->objects to its callers. This allows it > to be used with arbitrary object databases. > diff --git a/xdiff-interface.c b/xdiff-interface.c > index 1a35556380..cd7493730b 100644 > --- a/xdiff-interface.c > +++ b/xdiff-interface.c > ... > -void read_mmblob(mmfile_t *ptr, const struct object_id *oid) > +void read_mmblob(mmfile_t *ptr, struct object_database *odb, > + const struct object_id *oid) A possible alternative may be to pass "struct repository *" here, but this passes the (current) smallest piece of data necessary to drive the helper function odb_read_object(), so it would be fine. > { > unsigned long size; > enum object_type type; > > - if (oideq(oid, null_oid(the_hash_algo))) { > + if (is_null_oid(oid)) { > ptr->ptr = xstrdup(""); > ptr->size = 0; > return; > } > > - ptr->ptr = odb_read_object(the_repository->objects, oid, &type, &size); > + ptr->ptr = odb_read_object(odb, oid, &type, &size); > if (!ptr->ptr || type != OBJ_BLOB) > die("unable to read blob object %s", oid_to_hex(oid)); > ptr->size = size;