Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-02 01:02:57 +0300
committerJunio C Hamano <gitster@pobox.com>2021-03-02 01:02:57 +0300
commit6ee353d42f389ec9454161b64ffbeb4167edebaa (patch)
tree408986aa58c00c86025845ff01d7475a9333f933 /builtin/index-pack.c
parent660dd97a62da66ffe95df20a9e27a01e39ae473f (diff)
parent5476e1efded571e374cd97c7d69f17962ba1c44f (diff)
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
Diffstat (limited to 'builtin/index-pack.c')
-rw-r--r--builtin/index-pack.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 54f74c4874..bad5748807 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1712,6 +1712,22 @@ static void show_pack_info(int stat_only)
}
}
+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, rev_index;
@@ -1932,8 +1948,13 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
else
close(input_fd);
- if (do_fsck_object && fsck_finish(&fsck_options))
- die(_("fsck error in pack objects"));
+ if (do_fsck_object) {
+ struct fsck_options fo = fsck_options;
+
+ fo.error_func = print_dangling_gitmodules;
+ if (fsck_finish(&fo))
+ die(_("fsck error in pack objects"));
+ }
free(objects);
strbuf_release(&index_name_buf);