@matheusbsbs / matheus-bagliano / commits / 2aaeb9ac41
Fork 0

rev-list: use bitmap filters for traversal

This just passes the filter-options struct to prepare_bitmap_walk(). Since the bitmap code doesn't actually support any filters yet, it will fallback to the non-bitmap code if any --filter is specified. But this lets us exercise that rejection code path, as well as getting us ready to test filters via rev-list when we _do_ support them. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Feb 14, 2020 at 13:22 UTC 2aaeb9ac414d75f875efa968480db1ce85dc8dc5
1 file changed +8 -9
builtin/rev-list.c
+8 -9
@@ -372,7 +372,8 @@ static inline int parse_missing_action_value(const char *value)
372 return 0;
373 }
374
375 -static int try_bitmap_count(struct rev_info *revs)
375 +static int try_bitmap_count(struct rev_info *revs,
376 + struct list_objects_filter_options *filter)
377 {
378 uint32_t commit_count = 0,
379 tag_count = 0,
@@ -407,7 +408,7 @@ static int try_bitmap_count(struct rev_info *revs)
408 */
409 max_count = revs->max_count;
410
410 - bitmap_git = prepare_bitmap_walk(revs, NULL);
411 + bitmap_git = prepare_bitmap_walk(revs, filter);
412 if (!bitmap_git)
413 return -1;
414
@@ -423,7 +424,8 @@ static int try_bitmap_count(struct rev_info *revs)
424 return 0;
425 }
426
426 -static int try_bitmap_traversal(struct rev_info *revs)
427 +static int try_bitmap_traversal(struct rev_info *revs,
428 + struct list_objects_filter_options *filter)
429 {
430 struct bitmap_index *bitmap_git;
431
@@ -434,7 +436,7 @@ static int try_bitmap_traversal(struct rev_info *revs)
436 if (revs->max_count >= 0)
437 return -1;
438
437 - bitmap_git = prepare_bitmap_walk(revs, NULL);
439 + bitmap_git = prepare_bitmap_walk(revs, filter);
440 if (!bitmap_git)
441 return -1;
442
@@ -605,9 +607,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
607 (revs.left_right || revs.cherry_mark))
608 die(_("marked counting is incompatible with --objects"));
609
608 - if (filter_options.choice)
609 - use_bitmap_index = 0;
610 -
610 save_commit_buffer = (revs.verbose_header ||
611 revs.grep_filter.pattern_list ||
612 revs.grep_filter.header_list);
@@ -618,9 +617,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
617 progress = start_delayed_progress(show_progress, 0);
618
619 if (use_bitmap_index) {
621 - if (!try_bitmap_count(&revs))
620 + if (!try_bitmap_count(&revs, &filter_options))
621 return 0;
623 - if (!try_bitmap_traversal(&revs))
622 + if (!try_bitmap_traversal(&revs, &filter_options))
623 return 0;
624 }
625