From: Junio C Hamano Date: Mon, 2 Mar 2020 23:07:18 +0000 (-0800) Subject: Merge branch 'jk/object-filter-with-bitmap' X-Git-Tag: v2.26.0-rc0~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0df82d99dae85dbd4f667e95020a146ea0167975;p=thirdparty%2Fgit.git Merge branch 'jk/object-filter-with-bitmap' The object reachability bitmap machinery and the partial cloning machinery were not prepared to work well together, because some object-filtering criteria that partial clones use inherently rely on object traversal, but the bitmap machinery is an optimization to bypass that object traversal. There however are some cases where they can work together, and they were taught about them. * jk/object-filter-with-bitmap: rev-list --count: comment on the use of count_right++ pack-objects: support filters with bitmaps pack-bitmap: implement BLOB_LIMIT filtering pack-bitmap: implement BLOB_NONE filtering bitmap: add bitmap_unset() function rev-list: use bitmap filters for traversal pack-bitmap: basic noop bitmap filter infrastructure rev-list: allow commit-only bitmap traversals t5310: factor out bitmap traversal comparison rev-list: allow bitmaps when counting objects rev-list: make --count work with --objects rev-list: factor out bitmap-optimized routines pack-bitmap: refuse to do a bitmap traversal with pathspecs rev-list: fallback to non-bitmap traversal when filtering pack-bitmap: fix leak of haves/wants object lists pack-bitmap: factor out type iterator initialization --- 0df82d99dae85dbd4f667e95020a146ea0167975 diff --cc ewah/ewok.h index 1b98b57c8b,59f4ef7c4f..011852bef1 --- a/ewah/ewok.h +++ b/ewah/ewok.h @@@ -172,8 -172,8 +172,9 @@@ struct bitmap }; struct bitmap *bitmap_new(void); +struct bitmap *bitmap_word_alloc(size_t word_alloc); void bitmap_set(struct bitmap *self, size_t pos); + void bitmap_unset(struct bitmap *self, size_t pos); int bitmap_get(struct bitmap *self, size_t pos); void bitmap_reset(struct bitmap *self); void bitmap_free(struct bitmap *self); diff --cc pack-bitmap.c index 5a8689cdf8,9d680065e4..82bfd6672a --- a/pack-bitmap.c +++ b/pack-bitmap.c @@@ -637,15 -663,13 +670,15 @@@ static void show_objects_for_type struct bitmap *objects = bitmap_git->result; - ewah_iterator_init(&it, type_filter); - if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) - return; - + init_type_iterator(&it, bitmap_git, object_type); - while (i < objects->word_alloc && ewah_iterator_next(&filter, &it)) { + for (i = 0; i < objects->word_alloc && + ewah_iterator_next(&filter, &it); i++) { eword_t word = objects->words[i] & filter; + size_t pos = (i * BITS_IN_EWORD); + + if (!word) + continue; for (offset = 0; offset < BITS_IN_EWORD; ++offset) { struct object_id oid; diff --cc pack-bitmap.h index bcd03b8993,956775d0bb..1203120c43 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@@ -45,13 -45,14 +46,15 @@@ struct bitmap_index *prepare_bitmap_git void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags); void traverse_bitmap_commit_list(struct bitmap_index *, + struct rev_info *revs, show_reachable_fn show_reachable); void test_bitmap_walk(struct rev_info *revs); - struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs); + struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs, + struct list_objects_filter_options *filter); int reuse_partial_packfile_from_bitmap(struct bitmap_index *, struct packed_git **packfile, - uint32_t *entries, off_t *up_to); + uint32_t *entries, + struct bitmap **reuse_out); int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping, kh_oid_map_t *reused_bitmaps, int show_progress); void free_bitmap_index(struct bitmap_index *);