diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-07-08 13:15:00 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-07-08 13:15:00 -0700 |
| commit | 1ef488eaaaeba214dd2e03a256e976bd7740fe0a (patch) | |
| tree | 519b185bd1ceaafdb97518a85ccf38f466110f6b /pack-bitmap.c | |
| parent | 9f8aa6089af5ee5cdd85e25f4985a376d3ad78a9 (diff) | |
| parent | aa9ad6fee54898b9965f4fd26b3035fdd7b20f37 (diff) | |
| download | git-1ef488eaaaeba214dd2e03a256e976bd7740fe0a.tar.xz | |
Merge branch 'jk/bitmap-tree-optim'
Avoid duplicated work while building reachability bitmaps.
* jk/bitmap-tree-optim:
bitmaps: don't recurse into trees already in the bitmap
Diffstat (limited to 'pack-bitmap.c')
| -rw-r--r-- | pack-bitmap.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c index d90e1d9d8c..bfc10148f5 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -525,6 +525,22 @@ static int should_include(struct commit *commit, void *_data) return 1; } +static int should_include_obj(struct object *obj, void *_data) +{ + struct include_data *data = _data; + int bitmap_pos; + + bitmap_pos = bitmap_position(data->bitmap_git, &obj->oid); + if (bitmap_pos < 0) + return 1; + if ((data->seen && bitmap_get(data->seen, bitmap_pos)) || + bitmap_get(data->base, bitmap_pos)) { + obj->flags |= SEEN; + return 0; + } + return 1; +} + static int add_commit_to_bitmap(struct bitmap_index *bitmap_git, struct bitmap **base, struct commit *commit) @@ -620,6 +636,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, incdata.seen = seen; revs->include_check = should_include; + revs->include_check_obj = should_include_obj; revs->include_check_data = &incdata; if (prepare_revision_walk(revs)) @@ -633,6 +650,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, &show_data, NULL); revs->include_check = NULL; + revs->include_check_obj = NULL; revs->include_check_data = NULL; } |
