diff options
Diffstat (limited to 'pack-bitmap.c')
-rw-r--r-- | pack-bitmap.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c index f772d3c..6a7cdca 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -111,7 +111,7 @@ static struct ewah_bitmap *lookup_stored_bitmap(struct stored_bitmap *st) struct ewah_bitmap *parent; struct ewah_bitmap *composed; - if (st->xor == NULL) + if (!st->xor) return st->root; composed = ewah_pool_new(); @@ -279,7 +279,7 @@ static int load_bitmap_entries_v1(struct bitmap_index *index) if (xor_offset > 0) { xor_bitmap = recent_bitmaps[(i - xor_offset) % MAX_XOR_OFFSET]; - if (xor_bitmap == NULL) + if (!xor_bitmap) return error("Invalid XOR offset in bitmap pack index"); } @@ -358,7 +358,9 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, cleanup: munmap(bitmap_git->map, bitmap_git->map_size); bitmap_git->map_size = 0; + bitmap_git->map_pos = 0; bitmap_git->map = NULL; + bitmap_git->midx = NULL; return -1; } @@ -405,6 +407,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git munmap(bitmap_git->map, bitmap_git->map_size); bitmap_git->map = NULL; bitmap_git->map_size = 0; + bitmap_git->map_pos = 0; + bitmap_git->pack = NULL; return -1; } @@ -724,7 +728,7 @@ static int add_commit_to_bitmap(struct bitmap_index *bitmap_git, if (!or_with) return 0; - if (*base == NULL) + if (!*base) *base = ewah_to_bitmap(or_with); else bitmap_or_ewah(*base, or_with); @@ -735,8 +739,7 @@ static int add_commit_to_bitmap(struct bitmap_index *bitmap_git, static struct bitmap *find_objects(struct bitmap_index *bitmap_git, struct rev_info *revs, struct object_list *roots, - struct bitmap *seen, - struct list_objects_filter_options *filter) + struct bitmap *seen) { struct bitmap *base = NULL; int needs_walk = 0; @@ -768,7 +771,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, * Best case scenario: We found bitmaps for all the roots, * so the resulting `or` bitmap has the full reachability analysis */ - if (not_mapped == NULL) + if (!not_mapped) return base; roots = not_mapped; @@ -802,7 +805,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, struct include_data incdata; struct bitmap_show_data show_data; - if (base == NULL) + if (!base) base = bitmap_new(); incdata.bitmap_git = bitmap_git; @@ -819,9 +822,9 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, show_data.bitmap_git = bitmap_git; show_data.base = base; - traverse_commit_list_filtered(filter, revs, - show_commit, show_object, - &show_data, NULL); + traverse_commit_list(revs, + show_commit, show_object, + &show_data); revs->include_check = NULL; revs->include_check_obj = NULL; @@ -1215,7 +1218,6 @@ static int can_filter_bitmap(struct list_objects_filter_options *filter) } struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs, - struct list_objects_filter_options *filter, int filter_provided_objects) { unsigned int i; @@ -1236,7 +1238,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs, if (revs->prune) return NULL; - if (!can_filter_bitmap(filter)) + if (!can_filter_bitmap(&revs->filter)) return NULL; /* try to open a bitmapped pack, but don't parse it yet @@ -1293,17 +1295,15 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs, if (haves) { revs->ignore_missing_links = 1; - haves_bitmap = find_objects(bitmap_git, revs, haves, NULL, - filter); + haves_bitmap = find_objects(bitmap_git, revs, haves, NULL); reset_revision_walk(); revs->ignore_missing_links = 0; - if (haves_bitmap == NULL) + if (!haves_bitmap) BUG("failed to perform bitmap walk"); } - wants_bitmap = find_objects(bitmap_git, revs, wants, haves_bitmap, - filter); + wants_bitmap = find_objects(bitmap_git, revs, wants, haves_bitmap); if (!wants_bitmap) BUG("failed to perform bitmap walk"); @@ -1311,8 +1311,10 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs, if (haves_bitmap) bitmap_and_not(wants_bitmap, haves_bitmap); - filter_bitmap(bitmap_git, (filter && filter_provided_objects) ? NULL : wants, - wants_bitmap, filter); + filter_bitmap(bitmap_git, + (revs->filter.choice && filter_provided_objects) ? NULL : wants, + wants_bitmap, + &revs->filter); bitmap_git->result = wants_bitmap; bitmap_git->haves = haves_bitmap; @@ -1696,7 +1698,7 @@ void test_bitmap_walk(struct rev_info *revs) result = ewah_to_bitmap(bm); } - if (result == NULL) + if (!result) die("Commit %s doesn't have an indexed bitmap", oid_to_hex(&root->oid)); revs->tag_objects = 1; |