Message ID | beb7073581123c1a9096d466f1ccff7fa68f3a19.1717057290.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | object checking related additions and fixes for bundles in fetches | expand |
On Thu, May 30, 2024 at 08:21:28AM +0000, Xing Xin via GitGitGadget wrote:
> From: Xing Xin <xingxin.xx@bytedance.com>
Tiny nit: the important change in this commit is not that you wire up
the flag, but rather that we start to execute git-fsck(1) now. I'd thus
propose to adapt the commit title accordingly.
Patrick
At 2024-06-06 20:06:41, "Patrick Steinhardt" <ps@pks.im> wrote: >On Thu, May 30, 2024 at 08:21:28AM +0000, Xing Xin via GitGitGadget wrote: >> From: Xing Xin <xingxin.xx@bytedance.com> > >Tiny nit: the important change in this commit is not that you wire up >the flag, but rather that we start to execute git-fsck(1) now. I'd thus To be precise, it is adding a "--fsck-objects" flag to "git-index-pack". >propose to adapt the commit title accordingly. This commit is mapped to [PATCH v5 3/4] due to some adjustments to the commit order and implementation details. Hope the new title can better describe the new patch. Xing Xin
diff --git a/bundle-uri.c b/bundle-uri.c index 65666a11d9c..066ff788104 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -373,7 +373,7 @@ static int unbundle_from_file(struct repository *r, const char *file) * the prerequisite commits. */ if ((result = unbundle(r, &header, bundle_fd, NULL, - VERIFY_BUNDLE_QUIET))) + VERIFY_BUNDLE_QUIET | VERIFY_BUNDLE_FSCK_ALWAYS))) return 1; /* diff --git a/bundle.c b/bundle.c index 95367c2d0a0..26574e74bdd 100644 --- a/bundle.c +++ b/bundle.c @@ -625,6 +625,9 @@ int unbundle(struct repository *r, struct bundle_header *header, if (header->filter.choice) strvec_push(&ip.args, "--promisor=from-bundle"); + if (flags & VERIFY_BUNDLE_FSCK_ALWAYS) + strvec_push(&ip.args, "--fsck-objects"); + if (extra_index_pack_args) { strvec_pushv(&ip.args, extra_index_pack_args->v); strvec_clear(extra_index_pack_args); diff --git a/bundle.h b/bundle.h index 021adbdcbb3..cf23c8615d3 100644 --- a/bundle.h +++ b/bundle.h @@ -33,6 +33,7 @@ int create_bundle(struct repository *r, const char *path, enum verify_bundle_flags { VERIFY_BUNDLE_VERBOSE = (1 << 0), VERIFY_BUNDLE_QUIET = (1 << 1), + VERIFY_BUNDLE_FSCK_ALWAYS = (1 << 2), }; int verify_bundle(struct repository *r, struct bundle_header *header, diff --git a/transport.c b/transport.c index 0ad04b77fd2..1b3d61ffcec 100644 --- a/transport.c +++ b/transport.c @@ -184,7 +184,7 @@ static int fetch_refs_from_bundle(struct transport *transport, if (!data->get_refs_from_bundle_called) get_refs_from_bundle_inner(transport); ret = unbundle(the_repository, &data->header, data->fd, - &extra_index_pack_args, 0); + &extra_index_pack_args, VERIFY_BUNDLE_FSCK_ALWAYS); transport->hash_algo = data->header.hash_algo; return ret; }