repo_for_each_pack(the_repository, p) {
const char *pack_name = pack_basename(p);
- if ((item = string_list_lookup(&include_packs, pack_name)))
+ if ((item = string_list_lookup(&include_packs, pack_name))) {
+ if (exclude_promisor_objects && p->pack_promisor)
+ die(_("packfile %s is a promisor but --exclude-promisor-objects was given"), p->pack_name);
item->util = p;
+ }
if ((item = string_list_lookup(&exclude_packs, pack_name)))
item->util = p;
}
revs.tree_objects = 1;
revs.tag_objects = 1;
revs.ignore_missing_links = 1;
+ revs.exclude_promisor_objects = exclude_promisor_objects;
/* avoids adding objects in excluded packs */
ignore_packed_keep_in_core = 1;
exclude_promisor_objects_best_effort,
"--exclude-promisor-objects-best-effort");
if (exclude_promisor_objects) {
- use_internal_rev_list = 1;
fetch_if_missing = 0;
- strvec_push(&rp, "--exclude-promisor-objects");
+
+ /* --stdin-packs handles promisor objects separately. */
+ if (!stdin_packs) {
+ use_internal_rev_list = 1;
+ strvec_push(&rp, "--exclude-promisor-objects");
+ }
} else if (exclude_promisor_objects_best_effort) {
use_internal_rev_list = 1;
fetch_if_missing = 0;
)
'
+test_expect_success '--stdin-packs with promisors' '
+ test_when_finished "rm -fr repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ git config set maintenance.auto false &&
+ git remote add promisor garbage &&
+ git config set remote.promisor.promisor true &&
+
+ for c in A B C D
+ do
+ echo "$c" >file &&
+ git add file &&
+ git commit --message "$c" &&
+ git tag "$c" || return 1
+ done &&
+
+ A="$(echo A | git pack-objects --revs $packdir/pack)" &&
+ B="$(echo A..B | git pack-objects --revs $packdir/pack --filter=blob:none)" &&
+ C="$(echo B..C | git pack-objects --revs $packdir/pack)" &&
+ D="$(echo C..D | git pack-objects --revs $packdir/pack)" &&
+ touch $packdir/pack-$B.promisor &&
+
+ test_must_fail git pack-objects --stdin-packs --exclude-promisor-objects pack- 2>err <<-EOF &&
+ pack-$B.pack
+ EOF
+ test_grep "is a promisor but --exclude-promisor-objects was given" err &&
+
+ PACK=$(git pack-objects --stdin-packs=follow --exclude-promisor-objects $packdir/pack <<-EOF
+ pack-$D.pack
+ EOF
+ ) &&
+ objects_in_packs $C $D >expect &&
+ objects_in_packs $PACK >actual &&
+ test_cmp expect actual &&
+ rm -f $packdir/pack-$PACK.*
+ )
+'
+
stdin_packs__follow_with_only () {
rm -fr stdin_packs__follow_with_only &&
git init stdin_packs__follow_with_only &&