From: Junio C Hamano Date: Mon, 1 Mar 2021 22:02:57 +0000 (-0800) Subject: Merge branch 'jt/transfer-fsck-across-packs' X-Git-Tag: v2.31.0-rc1~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ee353d42f389ec9454161b64ffbeb4167edebaa;p=thirdparty%2Fgit.git Merge branch 'jt/transfer-fsck-across-packs' The approach to "fsck" the incoming objects in "index-pack" is attractive for performance reasons (we have them already in core, inflated and ready to be inspected), but fundamentally cannot be applied fully when we receive more than one pack stream, as a tree object in one pack may refer to a blob object in another pack as ".gitmodules", when we want to inspect blobs that are used as ".gitmodules" file, for example. Teach "index-pack" to emit objects that must be inspected later and check them in the calling "fetch-pack" process. * jt/transfer-fsck-across-packs: fetch-pack: print and use dangling .gitmodules fetch-pack: with packfile URIs, use index-pack arg http-fetch: allow custom index-pack args http: allow custom index-pack args --- 6ee353d42f389ec9454161b64ffbeb4167edebaa diff --cc builtin/index-pack.c index 54f74c4874,0444febeee..bad5748807 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@@ -1712,12 -1693,27 +1712,28 @@@ static void show_pack_info(int stat_onl } } + static int print_dangling_gitmodules(struct fsck_options *o, + const struct object_id *oid, + enum object_type object_type, + int msg_type, const char *message) + { + /* + * NEEDSWORK: Plumb the MSG_ID (from fsck.c) here and use it + * instead of relying on this string check. + */ + if (starts_with(message, "gitmodulesMissing")) { + printf("%s\n", oid_to_hex(oid)); + return 0; + } + return fsck_error_function(o, oid, object_type, msg_type, message); + } + int cmd_index_pack(int argc, const char **argv, const char *prefix) { - int i, fix_thin_pack = 0, verify = 0, stat_only = 0; + int i, fix_thin_pack = 0, verify = 0, stat_only = 0, rev_index; const char *curr_index; - const char *index_name = NULL, *pack_name = NULL; + const char *curr_rev_index = NULL; + const char *index_name = NULL, *pack_name = NULL, *rev_index_name = NULL; const char *keep_msg = NULL; const char *promisor_msg = NULL; struct strbuf index_name_buf = STRBUF_INIT; diff --cc fsck.h index 423c467feb,d75b723bd5..733378f126 --- a/fsck.h +++ b/fsck.h @@@ -62,15 -62,8 +62,17 @@@ int fsck_walk(struct object *obj, void int fsck_object(struct object *obj, void *data, unsigned long size, struct fsck_options *options); + void register_found_gitmodules(const struct object_id *oid); + +/* + * fsck a tag, and pass info about it back to the caller. This is + * exposed fsck_object() internals for git-mktag(1). + */ +int fsck_tag_standalone(const struct object_id *oid, const char *buffer, + unsigned long size, struct fsck_options *options, + struct object_id *tagged_oid, + int *tag_type); + /* * Some fsck checks are context-dependent, and may end up queued; run this * after completing all fsck_object() calls in order to resolve any remaining diff --cc pack.h index afdcf8f5c7,09cffec395..857cbd5bd4 --- a/pack.h +++ b/pack.h @@@ -87,14 -85,8 +87,14 @@@ int verify_pack_index(struct packed_gi int verify_pack(struct repository *, struct packed_git *, verify_fn fn, struct progress *, uint32_t); off_t write_pack_header(struct hashfile *f, uint32_t); void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t, unsigned char *, off_t); - char *index_pack_lockfile(int fd); + char *index_pack_lockfile(int fd, int *is_well_formed); +struct ref; + +void write_promisor_file(const char *promisor_name, struct ref **sought, int nr_sought); + +const char *write_rev_file(const char *rev_name, struct pack_idx_entry **objects, uint32_t nr_objects, const unsigned char *hash, unsigned flags); + /* * The "hdr" output buffer should be at least this big, which will handle sizes * up to 2^67.