diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-08-24 16:15:54 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-24 20:21:13 (GMT) |
commit | 3ba3d0621b6822e974f06123db9394b33e454ed7 (patch) | |
tree | 1109de708b1903da2496b273de98daf057e2c4e4 /pack-bitmap.h | |
parent | fa95666a403e5dda4c2c14ac168b5c3389126e6c (diff) | |
download | git-3ba3d0621b6822e974f06123db9394b33e454ed7.zip git-3ba3d0621b6822e974f06123db9394b33e454ed7.tar.gz git-3ba3d0621b6822e974f06123db9394b33e454ed7.tar.bz2 |
pack-bitmap-write.c: gracefully fail to write non-closed bitmaps
The set of objects covered by a bitmap must be closed under
reachability, since it must be the case that there is a valid bit
position assigned for every possible reachable object (otherwise the
bitmaps would be incomplete).
Pack bitmaps are never written from 'git repack' unless repacking
all-into-one, and so we never write non-closed bitmaps (except in the
case of partial clones where we aren't guaranteed to have all objects).
But multi-pack bitmaps change this, since it isn't known whether the
set of objects in the MIDX is closed under reachability until walking
them. Plumb through a bit that is set when a reachable object isn't
found.
As soon as a reachable object isn't found in the set of objects to
include in the bitmap, bitmap_writer_build() knows that the set is not
closed, and so it now fails gracefully.
A test is added in t0410 to trigger a bitmap write without full
reachability closure by removing local copies of some reachable objects
from a promisor remote.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap.h')
-rw-r--r-- | pack-bitmap.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pack-bitmap.h b/pack-bitmap.h index 99d733e..020cd8d 100644 --- a/pack-bitmap.h +++ b/pack-bitmap.h @@ -87,7 +87,7 @@ struct ewah_bitmap *bitmap_for_commit(struct bitmap_index *bitmap_git, struct commit *commit); void bitmap_writer_select_commits(struct commit **indexed_commits, unsigned int indexed_commits_nr, int max_bitmaps); -void bitmap_writer_build(struct packing_data *to_pack); +int bitmap_writer_build(struct packing_data *to_pack); void bitmap_writer_finish(struct pack_idx_entry **index, uint32_t index_nr, const char *filename, |