[PATCH v2 0/6] odb: make packfile generation pluggable
From: Patrick Steinhardt <hidden>
Date: 2026-08-17 05:39:48
Hi, this patch series makes packfile generation pluggable. Note that this series only makes those parts pluggable that are required for the transport layer. The other parts that relate to packfile generation as required by our repository maintenance is kept as-is, as there is a bunch of options there that are way too specific to the "files" backend to be portable. This should ultimately not be much of a problem though, as maintenance itself is already pluggable in the first place. It's a bit of a shame though for git-pack-objects(1), which still isn't usable with alternate backends. I tried several times to find good solutions for making it fully pluggable, but due to the backend-specific options it's an utter mess. I want to eventually address this though: same as with git-refs(1), I want to introduce git-objects(1) to care about all things ODB. And as part of that command we can also introduce a command that generates packfiles in a generic fashion, without all the cruft that git-pack-objects(1) has. This is part of a future patch series though. Changes in v2: - Mostly remove the dependencies on `the_repository` in "bundle.c". - Link to v1: https://patch.msgid.link/20260807-b4-pks-odb-generate-pack-v1-0-7dec431ae7cd@pks.im The series is built on top of 2c78326f81 (The 11th batch, 2026-08-05). Thanks! Patrick --- Patrick Steinhardt (6): odb: introduce interface to generate packfiles upload-pack: generate packfiles via the object database send-pack: generate packfiles via the object database builtin/bundle: refactor option handling for progress meter bundle: get (mostly) rid of `the_repository` bundle: generate packfiles via the object database builtin/bundle.c | 31 ++++------ bundle.c | 97 ++++++++++++++++++-------------- bundle.h | 3 +- odb.c | 21 +++++++ odb.h | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++ odb/source-files.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++ odb/source.h | 33 +++++++++++ send-pack.c | 101 +++++++++++---------------------- t/t5516-fetch-push.sh | 12 ++-- upload-pack.c | 125 +++++++++++++++-------------------------- 10 files changed, 501 insertions(+), 218 deletions(-) Range-diff versus v1: 1: fb02483cbf = 1: 44fdb3dabf odb: introduce interface to generate packfiles 2: 1293fa4488 = 2: 01a115f7b1 upload-pack: generate packfiles via the object database 3: 98bf918183 = 3: 07e2541ca7 send-pack: generate packfiles via the object database 4: 900536a5fd = 4: dd3f7eaab7 builtin/bundle: refactor option handling for progress meter -: ---------- > 5: cf01244c05 bundle: get (mostly) rid of `the_repository` 5: 37c0dc5d99 ! 6: fa4d4dfdd5 bundle: generate packfiles via the object database @@ builtin/bundle.c: static int cmd_bundle_create(int argc, const char **argv, cons } ## bundle.c ## -@@ bundle.c: static int is_tag_in_date_range(struct object *tag, struct rev_info *revs) +@@ bundle.c: static int is_tag_in_date_range(struct repository *repo, /* Write the pack data to bundle_fd */ @@ bundle.c: static int is_tag_in_date_range(struct object *tag, struct rev_info *r struct object *object = revs->pending.objects[i].item; if (object->flags & UNINTERESTING) - write_or_die(pack_objects.in, "^", 1); -- write_or_die(pack_objects.in, oid_to_hex(&object->oid), the_hash_algo->hexsz); +- write_or_die(pack_objects.in, oid_to_hex(&object->oid), +- revs->repo->hash_algo->hexsz); - write_or_die(pack_objects.in, "\n", 1); + oid_array_append(&opts.haves, &object->oid); + else @@ bundle.c: static int is_tag_in_date_range(struct object *tag, struct rev_info *r - return error(_("pack-objects died")); - return 0; + -+ if (odb_generate_pack(the_repository->objects, &generator, &opts)) { ++ if (odb_generate_pack(revs->repo->objects, &generator, &opts)) { + ret = error(_("Could not spawn pack-objects")); + goto out; + } --- base-commit: 2c78326f810173a4f3aefd8021f1e07575412481 change-id: 20260807-b4-pks-odb-generate-pack-f30fbcdef3fc