add --exclude-promisor-pack-objects option to revision walk, this option will be used by git repack in following commits. Unlike --exclude-promisor-objects, which exclude promisor objects, --exclude-promisor-pack-objects only excludes objects in promisor packfile, objects referenced by objects in promisor pack are not excluded. --- revision.c | 13 ++++++++++++- revision.h | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index 6b33bd814f..7bb03a84c2 100644 --- a/revision.c +++ b/revision.c @@ -2701,6 +2701,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg if (fetch_if_missing) BUG("exclude_promisor_objects can only be used when fetch_if_missing is 0"); revs->exclude_promisor_objects = 1; + } else if (opt && opt->allow_exclude_promisor_objects && + !strcmp(arg, "--exclude-promisor-pack-objects")) { + if (fetch_if_missing) + BUG("exclude_promisor_pack_objects can only be used when fetch_if_missing is 0"); + revs->exclude_promisor_pack_objects = 1; } else { int opts = diff_opt_parse(&revs->diffopt, argv, argc, revs->prefix); if (!opts) @@ -3908,7 +3913,7 @@ int prepare_revision_walk(struct rev_info *revs) (revs->limited && limiting_can_increase_treesame(revs))) revs->treesame.name = "treesame"; - if (revs->exclude_promisor_objects) { + if (revs->exclude_promisor_objects || revs->exclude_promisor_pack_objects) { for_each_packed_object(mark_uninteresting, revs, FOR_EACH_OBJECT_PROMISOR_ONLY); } @@ -4275,6 +4280,12 @@ static struct commit *get_revision_1(struct rev_info *revs) if (!commit) return NULL; + if (revs->exclude_promisor_objects && is_promisor_object(&commit->object.oid)) + continue; + + if (revs->exclude_promisor_pack_objects && is_in_promisor_pack(&commit->object.oid, 0)) + continue; + if (revs->reflog_info) commit->object.flags &= ~(ADDED | SEEN | SHOWN); diff --git a/revision.h b/revision.h index 0e470d1df1..6219c35c45 100644 --- a/revision.h +++ b/revision.h @@ -229,7 +229,8 @@ struct rev_info { do_not_die_on_missing_objects:1, /* for internal use only */ - exclude_promisor_objects:1; + exclude_promisor_objects:1, + exclude_promisor_pack_objects:1; /* Diff flags */ unsigned int diff:1, -- 2.45.2