summaryrefslogtreecommitdiff
path: root/pack-bitmap.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-09-01 07:49:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-04 15:40:12 (GMT)
commit715d0c50e1ba479290d9fcb34119d8f9a09bfed3 (patch)
treef610a31f097a9562075cc49b8a327ffc2dd87448 /pack-bitmap.c
parentc0d61dfc0b248f100987d92545016bce71f92663 (diff)
downloadgit-715d0c50e1ba479290d9fcb34119d8f9a09bfed3.zip
git-715d0c50e1ba479290d9fcb34119d8f9a09bfed3.tar.gz
git-715d0c50e1ba479290d9fcb34119d8f9a09bfed3.tar.bz2
traverse_bitmap_commit_list(): don't free result
Since it was introduced in fff42755ef (pack-bitmap: add support for bitmap indexes, 2013-12-21), this function has freed the result after traversing it. That is an artifact of the early days of the bitmap code, when we had a single static "struct bitmap_index". Back then, it was intended that you would do: prepare_bitmap_walk(&revs); traverse_bitmap_commit_list(&revs); Since the actual bitmap_index struct was totally behind the scenes, it was convenient for traverse_bitmap_commit_list() to clean it up, clearing the way for another traversal. But since 3ae5fa0768 (pack-bitmap: remove bitmap_git global variable, 2018-06-07), the caller explicitly manages the bitmap_index struct itself, like this: b = prepare_bitmap_walk(&revs); traverse_bitmap_commit_list(b, &revs); free_bitmap_index(b); It no longer makes sense to auto-free the result after the traversal. If you want to do another traversal, you'd just create a new bitmap_index. And while nobody tries to call traverse_bitmap_commit_list() twice, the fact that it throws away the result might be surprising, and is better avoided. Note that in the "old" way it was possible for two walks to amortize the cost of opening the on-disk .bitmap file (since it was stored in the global bitmap_index), but we lost that in 3ae5fa0768. However, no code actually does this, so it's not worth addressing now. The solution might involve a new: reset_bitmap_walk(b, &revs); call. Or we might even attach the bitmap data to its matching packed_git struct, so that multiple prepare_bitmap_walk() calls could use it. That can wait until somebody actually has need of the optimization (and until then, we'll do the correct, unsurprising thing). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap.c')
-rw-r--r--pack-bitmap.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 76fd93a..8c1af1c 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -848,9 +848,6 @@ void traverse_bitmap_commit_list(struct bitmap_index *bitmap_git,
OBJ_TAG, show_reachable);
show_extended_objects(bitmap_git, show_reachable);
-
- bitmap_free(bitmap_git->result);
- bitmap_git->result = NULL;
}
static uint32_t count_object_type(struct bitmap_index *bitmap_git,