On 2/13/2019 11:37 PM, Jeff King wrote:
> +static void *lookup_object_by_type(struct repository *r,
> + const struct object_id *oid,
> + enum object_type type)
> +{
> + switch (type) {
> + case OBJ_COMMIT:
> + return lookup_commit(r, oid);
> + case OBJ_TREE:
> + return lookup_tree(r, oid);
> + case OBJ_TAG:
> + return lookup_tag(r, oid);
> + case OBJ_BLOB:
> + return lookup_blob(r, oid);
> + default:
> + die("BUG: unknown object type %d", type);
> + }
> +}
> +
> +static int mark_object_seen(const struct object_id *oid,
> + enum object_type type,
> + int exclude,
> + uint32_t name_hash,
> + struct packed_git *found_pack,
> + off_t found_offset)
> +{
> + struct object *obj = lookup_object_by_type(the_repository, oid, type);
> + if (!obj)
> + die("unable to create object '%s'", oid_to_hex(oid));
> +
> + obj->flags |= SEEN;
> + return 0;
> +}
> +
> void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
> timestamp_t mark_recent, struct progress *progress)
> {
> struct connectivity_progress cp;
> + struct bitmap_index *bitmap_git;
>
> /*
> * Set up revision parsing, and mark us as being interested
> @@ -188,6 +223,13 @@ void mark_reachable_objects(struct rev_info *revs, int
> mark_reflog,
> cp.progress = progress;
> cp.count = 0;
>
> + bitmap_git = prepare_bitmap_walk(revs);
> + if (bitmap_git) {
> + traverse_bitmap_commit_list(bitmap_git, mark_object_seen);
> + free_bitmap_index(bitmap_git);
> + return;
> + }
> +
Peff,
This block after "if (bitmap_git)" is not exercised by the (non-performance)
test suite, so the rest of the code above is not tested, either. Could a test
of this "prune" capability be added to the regression tests around the bitmaps?
Thanks,
-Stolee