diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-04-13 15:28:50 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-13 15:28:50 -0700 |
commit | 0623669fc6ddc6dc1ad706f135826f9a0910dd4b (patch) | |
tree | 79ba87fbe7d0f045f7acb616ab7086ae1562d38d /builtin | |
parent | Merge branch 'jk/ref-filter-segfault-fix' (diff) | |
parent | builtin/pack-objects.c: respect 'pack.preferBitmapTips' (diff) | |
download | tgif-0623669fc6ddc6dc1ad706f135826f9a0910dd4b.tar.xz |
Merge branch 'tb/pack-preferred-tips-to-give-bitmap'
A configuration variable has been added to force tips of certain
refs to be given a reachability bitmap.
* tb/pack-preferred-tips-to-give-bitmap:
builtin/pack-objects.c: respect 'pack.preferBitmapTips'
t/helper/test-bitmap.c: initial commit
pack-bitmap: add 'test_bitmap_commits()' helper
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/pack-objects.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 525c2d8552..a1e33d7507 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -3547,6 +3547,37 @@ static void record_recent_commit(struct commit *commit, void *data) oid_array_append(&recent_objects, &commit->object.oid); } +static int mark_bitmap_preferred_tip(const char *refname, + const struct object_id *oid, int flags, + void *_data) +{ + struct object_id peeled; + struct object *object; + + if (!peel_iterated_oid(oid, &peeled)) + oid = &peeled; + + object = parse_object_or_die(oid, refname); + if (object->type == OBJ_COMMIT) + object->flags |= NEEDS_BITMAP; + + return 0; +} + +static void mark_bitmap_preferred_tips(void) +{ + struct string_list_item *item; + const struct string_list *preferred_tips; + + preferred_tips = bitmap_preferred_tips(the_repository); + if (!preferred_tips) + return; + + for_each_string_list_item(item, preferred_tips) { + for_each_ref_in(item->string, mark_bitmap_preferred_tip, NULL); + } +} + static void get_object_list(int ac, const char **av) { struct rev_info revs; @@ -3601,6 +3632,9 @@ static void get_object_list(int ac, const char **av) if (use_delta_islands) load_delta_islands(the_repository, progress); + if (write_bitmap_index) + mark_bitmap_preferred_tips(); + if (prepare_revision_walk(&revs)) die(_("revision walk setup failed")); mark_edges_uninteresting(&revs, show_edge, sparse); |