From: Patrick Steinhardt Date: Fri, 14 Aug 2026 08:51:24 GMT Subject: Re: [PATCH v3 9/9] odb/transaction: add transaction interface to write packfiles Message-ID: In-Reply-To: <20260811175415.2044235-10-jltobler@gmail.com> On Tue, Aug 11, 2026 at 12:54:15PM -0500, Justin Tobler wrote: report_v2(commands, &unpack_status); > diff --git a/object-file.c b/object-file.c > index db63587f6d..a957bc126f 100644 > --- a/object-file.c > +++ b/object-file.c > @@ -1291,6 +1297,170 @@ static int odb_transaction_files_commit(struct odb_transaction *base) > return 0; > } > > +static const char *parse_pack_header(struct pack_header *hdr, int pack_fd) > +{ > + switch (read_pack_header(pack_fd, hdr)) { > + case PH_ERROR_EOF: > + return "eof before pack header was fully read"; > + > + case PH_ERROR_PACK_SIGNATURE: > + return "protocol error (pack signature mismatch detected)"; > + > + case PH_ERROR_PROTOCOL: > + return "protocol error (pack version unsupported)"; > + > + default: > + return "unknown error in parse_pack_header"; > + > + case 0: > + return NULL; > + } > +} > + > +static void push_header_arg(struct strvec *args, struct pack_header *hdr) > +{ > + strvec_pushf(args, "--pack_header=%"PRIu32",%"PRIu32, > + ntohl(hdr->hdr_version), ntohl(hdr->hdr_entries)); > +} > + > +static unsigned int get_unpack_limit(struct repository *repo) > +{ > + unsigned int limit = 100; > + > + repo_config_get_uint(repo, "transfer.unpacklimit", &limit); > + repo_config_get_uint(repo, "receive.unpacklimit", &limit); > + > + return limit; > +} One thing I noticed just now: as the intention is that `write_pack()` will be called for more use cases than only git-receive-pack(1) we'll have to add a way to tell the callback what scenario they are running in. I still think moving the unpack limit into the backend is sensible, but now we're not givint it enough information. Patrick