unbundle: extend object verification for fetches
The existing fetch.fsckObjects and transfer.fsckObjects configurations were not fully applied to bundle-involved fetches, including direct bundle fetches and bundle-uri enabled fetches. Furthermore, there was no object verification support for unbundle. This commit extends object verification support in `bundle.c:unbundle` by adding the `VERIFY_BUNDLE_FSCK` option to `verify_bundle_flags`. When this option is enabled, we append the `--fsck-objects` flag to `git-index-pack`. The `VERIFY_BUNDLE_FSCK` option is now used by bundle-involved fetches, where we use `fetch-pack.c:fetch_pack_fsck_objects` to determine whether to enable this option for `bundle.c:unbundle`, specifically in: - `transport.c:fetch_refs_from_bundle` for direct bundle fetches. - `bundle-uri.c:unbundle_from_file` for bundle-uri enabled fetches. This addition ensures a consistent logic for object verification during fetches. Tests have been added to confirm functionality in the scenarios mentioned above. Reviewed-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Xing Xin <xingxin.xx@bytedance.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
#include "hashmap.h"
|
||||
#include "pkt-line.h"
|
||||
#include "config.h"
|
||||
#include "fetch-pack.h"
|
||||
#include "remote.h"
|
||||
|
||||
static struct {
|
||||
@ -373,7 +374,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 | (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0))))
|
||||
return 1;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user