]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bundle: unbundle promisor packs
authorDerrick Stolee <derrickstolee@github.com>
Wed, 9 Mar 2022 16:01:42 +0000 (16:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Mar 2022 18:25:28 +0000 (10:25 -0800)
In order to have a valid pack-file after unbundling a bundle that has
the 'filter' capability, we need to generate a .promisor file. The
bundle does not promise _where_ the objects can be found, but we can
expect that these bundles will be unbundled in repositories with
appropriate promisor remotes that can find those missing objects.

Use the 'git index-pack --promisor=<message>' option to create this
.promisor file. Add "from-bundle" as the message to help anyone diagnose
issues with these promisor packs.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bundle.c
t/t6020-bundle-misc.sh

index 9370a6e307cfa625131c5172b00272c0903d7df6..56681c21131619caac82b7a81e527e7974a9ec62 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -620,6 +620,10 @@ int unbundle(struct repository *r, struct bundle_header *header,
        struct child_process ip = CHILD_PROCESS_INIT;
        strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL);
 
+       /* If there is a filter, then we need to create the promisor pack. */
+       if (header->filter.choice)
+               strvec_push(&ip.args, "--promisor=from-bundle");
+
        if (extra_index_pack_args) {
                strvec_pushv(&ip.args, extra_index_pack_args->v);
                strvec_clear(extra_index_pack_args);
index 6e97c044ee7fa83f7c3fa837cae01d1ebec85331..7c6db67022159f632d3a4ec01b742accd5984916 100755 (executable)
@@ -521,6 +521,8 @@ do
 
                git init unbundled &&
                git -C unbundled bundle unbundle ../partial.bdl >ref-list.txt &&
+               ls unbundled/.git/objects/pack/pack-*.promisor >promisor &&
+               test_line_count = 1 promisor &&
 
                # Count the same number of reachable objects.
                reflist=$(git for-each-ref --format="%(objectname)") &&