Skip to content

Commit 4f39eb0

Browse files
derrickstoleegitster
authored andcommitted
bundle: unbundle promisor packs
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f18b512 commit 4f39eb0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

bundle.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,10 @@ int unbundle(struct repository *r, struct bundle_header *header,
620620
struct child_process ip = CHILD_PROCESS_INIT;
621621
strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL);
622622

623+
/* If there is a filter, then we need to create the promisor pack. */
624+
if (header->filter.choice)
625+
strvec_push(&ip.args, "--promisor=from-bundle");
626+
623627
if (extra_index_pack_args) {
624628
strvec_pushv(&ip.args, extra_index_pack_args->v);
625629
strvec_clear(extra_index_pack_args);

t/t6020-bundle-misc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ do
521521
522522
git init unbundled &&
523523
git -C unbundled bundle unbundle ../partial.bdl >ref-list.txt &&
524+
ls unbundled/.git/objects/pack/pack-*.promisor >promisor &&
525+
test_line_count = 1 promisor &&
524526
525527
# Count the same number of reachable objects.
526528
reflist=$(git for-each-ref --format="%(objectname)") &&

0 commit comments

Comments
 (0)