aboutsummaryrefslogtreecommitdiffstats
path: root/pack-bitmap.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-02-16 15:14:29 -0800
committerJunio C Hamano <gitster@pobox.com>2022-02-16 15:14:29 -0800
commitf2cb46a6b3398308d148c037fdd786e6d45b59bf (patch)
treedb3bd0f923d27a86c89fff8e4f489fa0990a7251 /pack-bitmap.c
parentMerge branch 'en/remerge-diff' (diff)
parentpack-bitmap.c: gracefully fallback after opening pack/MIDX (diff)
downloadgit-f2cb46a6b3398308d148c037fdd786e6d45b59bf.tar.gz
git-f2cb46a6b3398308d148c037fdd786e6d45b59bf.zip
Merge branch 'tb/midx-bitmap-corruption-fix'
A bug that made multi-pack bitmap and the object order out-of-sync, making the .midx data corrupt, has been fixed. * tb/midx-bitmap-corruption-fix: pack-bitmap.c: gracefully fallback after opening pack/MIDX midx: read `RIDX` chunk when present t/lib-bitmap.sh: parameterize tests over reverse index source t5326: move tests to t/lib-bitmap.sh t5326: extract `test_rev_exists` t5326: drop unnecessary setup pack-revindex.c: instrument loading on-disk reverse index midx.c: make changing the preferred pack safe t5326: demonstrate bitmap corruption after permutation
Diffstat (limited to 'pack-bitmap.c')
-rw-r--r--pack-bitmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c
index f772d3cb7f..9c666cdb8b 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -358,7 +358,9 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
cleanup:
munmap(bitmap_git->map, bitmap_git->map_size);
bitmap_git->map_size = 0;
+ bitmap_git->map_pos = 0;
bitmap_git->map = NULL;
+ bitmap_git->midx = NULL;
return -1;
}
@@ -405,6 +407,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
munmap(bitmap_git->map, bitmap_git->map_size);
bitmap_git->map = NULL;
bitmap_git->map_size = 0;
+ bitmap_git->map_pos = 0;
+ bitmap_git->pack = NULL;
return -1;
}