]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jt/transfer-fsck-across-packs'
authorJunio C Hamano <gitster@pobox.com>
Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)
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

1  2 
Documentation/git-index-pack.txt
builtin/index-pack.c
builtin/receive-pack.c
fetch-pack.c
fsck.c
fsck.h
pack-write.c
pack.h
t/t5550-http-fetch-dumb.sh
t/t5702-protocol-v2.sh

Simple merge
index 54f74c48741df84f35cc5269c332b51a347f7fa0,0444febeee698cc4e062aa0bfc4c19fad17e7739..bad57488079c7f7ec715f9efd935e255c871e8f1
@@@ -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;
Simple merge
diff --cc fetch-pack.c
Simple merge
diff --cc fsck.c
Simple merge
diff --cc fsck.h
index 423c467feb70307a0d60aa5563be38a1a8812d2b,d75b723bd5678c9cc3fa00c53d32e260e2ca2574..733378f1260a89bcda654e1f6e2b5144e8d2ab3e
--- 1/fsck.h
--- 2/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-write.c
Simple merge
diff --cc pack.h
index afdcf8f5c74df66eb3ea2dc10bf825d1b53ec17b,09cffec395c7cf24dca78599015bf4a17842e859..857cbd5bd4b55a9d21b2ef756d1d56ba65a58c55
--- 1/pack.h
--- 2/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.
Simple merge
Simple merge