Skip to content

Commit 47ff853

Browse files
ttaylorrgitster
authored andcommitted
pack-bitmap.c: extract fill_in_bitmap()
To prepare for the boundary-based bitmap walk to perform a fill-in traversal using the boundary of either side as the tips, extract routine used to perform fill-in traversal by `find_objects()` so that it can be used in both places. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fe90355 commit 47ff853

File tree

1 file changed

+36
-29
lines changed

1 file changed

+36
-29
lines changed

pack-bitmap.c

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,40 @@ static int add_commit_to_bitmap(struct bitmap_index *bitmap_git,
10431043
return 1;
10441044
}
10451045

1046+
static struct bitmap *fill_in_bitmap(struct bitmap_index *bitmap_git,
1047+
struct rev_info *revs,
1048+
struct bitmap *base,
1049+
struct bitmap *seen)
1050+
{
1051+
struct include_data incdata;
1052+
struct bitmap_show_data show_data;
1053+
1054+
if (!base)
1055+
base = bitmap_new();
1056+
1057+
incdata.bitmap_git = bitmap_git;
1058+
incdata.base = base;
1059+
incdata.seen = seen;
1060+
1061+
revs->include_check = should_include;
1062+
revs->include_check_obj = should_include_obj;
1063+
revs->include_check_data = &incdata;
1064+
1065+
if (prepare_revision_walk(revs))
1066+
die(_("revision walk setup failed"));
1067+
1068+
show_data.bitmap_git = bitmap_git;
1069+
show_data.base = base;
1070+
1071+
traverse_commit_list(revs, show_commit, show_object, &show_data);
1072+
1073+
revs->include_check = NULL;
1074+
revs->include_check_obj = NULL;
1075+
revs->include_check_data = NULL;
1076+
1077+
return base;
1078+
}
1079+
10461080
static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
10471081
struct rev_info *revs,
10481082
struct object_list *roots,
@@ -1108,35 +1142,8 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
11081142
}
11091143
}
11101144

1111-
if (needs_walk) {
1112-
struct include_data incdata;
1113-
struct bitmap_show_data show_data;
1114-
1115-
if (!base)
1116-
base = bitmap_new();
1117-
1118-
incdata.bitmap_git = bitmap_git;
1119-
incdata.base = base;
1120-
incdata.seen = seen;
1121-
1122-
revs->include_check = should_include;
1123-
revs->include_check_obj = should_include_obj;
1124-
revs->include_check_data = &incdata;
1125-
1126-
if (prepare_revision_walk(revs))
1127-
die(_("revision walk setup failed"));
1128-
1129-
show_data.bitmap_git = bitmap_git;
1130-
show_data.base = base;
1131-
1132-
traverse_commit_list(revs,
1133-
show_commit, show_object,
1134-
&show_data);
1135-
1136-
revs->include_check = NULL;
1137-
revs->include_check_obj = NULL;
1138-
revs->include_check_data = NULL;
1139-
}
1145+
if (needs_walk)
1146+
base = fill_in_bitmap(bitmap_git, revs, base, seen);
11401147

11411148
return base;
11421149
}

0 commit comments

Comments
 (0)