Skip to content

Commit 2aaeb9a

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6663ae0 commit 2aaeb9a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

builtin/rev-list.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ static inline int parse_missing_action_value(const char *value)
372372
return 0;
373373
}
374374

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)
376377
{
377378
uint32_t commit_count = 0,
378379
tag_count = 0,
@@ -407,7 +408,7 @@ static int try_bitmap_count(struct rev_info *revs)
407408
*/
408409
max_count = revs->max_count;
409410

410-
bitmap_git = prepare_bitmap_walk(revs, NULL);
411+
bitmap_git = prepare_bitmap_walk(revs, filter);
411412
if (!bitmap_git)
412413
return -1;
413414

@@ -423,7 +424,8 @@ static int try_bitmap_count(struct rev_info *revs)
423424
return 0;
424425
}
425426

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)
427429
{
428430
struct bitmap_index *bitmap_git;
429431

@@ -434,7 +436,7 @@ static int try_bitmap_traversal(struct rev_info *revs)
434436
if (revs->max_count >= 0)
435437
return -1;
436438

437-
bitmap_git = prepare_bitmap_walk(revs, NULL);
439+
bitmap_git = prepare_bitmap_walk(revs, filter);
438440
if (!bitmap_git)
439441
return -1;
440442

@@ -605,9 +607,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
605607
(revs.left_right || revs.cherry_mark))
606608
die(_("marked counting is incompatible with --objects"));
607609

608-
if (filter_options.choice)
609-
use_bitmap_index = 0;
610-
611610
save_commit_buffer = (revs.verbose_header ||
612611
revs.grep_filter.pattern_list ||
613612
revs.grep_filter.header_list);
@@ -618,9 +617,9 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
618617
progress = start_delayed_progress(show_progress, 0);
619618

620619
if (use_bitmap_index) {
621-
if (!try_bitmap_count(&revs))
620+
if (!try_bitmap_count(&revs, &filter_options))
622621
return 0;
623-
if (!try_bitmap_traversal(&revs))
622+
if (!try_bitmap_traversal(&revs, &filter_options))
624623
return 0;
625624
}
626625

0 commit comments

Comments
 (0)