diff options
| author | Taylor Blau <me@ttaylorr.com> | 2022-10-17 22:45:12 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-10-17 21:26:16 -0700 |
| commit | 55d902cd61a8fd2e9b9aa4bf49b47e4dbf10ea67 (patch) | |
| tree | 00cf2b80e37119273c4c75e4e76eba1d10147287 /t | |
| parent | Git 2.38 (diff) | |
| download | git-55d902cd61a8fd2e9b9aa4bf49b47e4dbf10ea67.tar.gz git-55d902cd61a8fd2e9b9aa4bf49b47e4dbf10ea67.zip | |
builtin/repack.c: remove redundant pack-based bitmaps
When we write a MIDX bitmap after repacking, it is possible that the
repository would be left in a state with both pack- and multi-pack
reachability bitmaps.
This can occur, for instance, if a pack that was kept (either by having
a .keep file, or during a geometric repack in which it is not rolled up)
has a bitmap file, and the repack wrote a multi-pack index and bitmap.
When loading a reachability bitmap for the repository, the multi-pack
one is always preferred, so the pack-based one is redundant. Let's
remove it unconditionally, even if '-d' isn't passed, since there is no
practical reason to keep both around. The patch below does just that.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rwxr-xr-x | t/t7700-repack.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index ca45c4cd2c..2d0e9448dd 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -426,6 +426,27 @@ test_expect_success '--write-midx -b packs non-kept objects' ' ) ' +test_expect_success '--write-midx removes stale pack-based bitmaps' ' + rm -fr repo && + git init repo && + test_when_finished "rm -fr repo" && + ( + cd repo && + test_commit base && + GIT_TEST_MULTI_PACK_INDEX=0 git repack -Ab && + + pack_bitmap=$(ls $objdir/pack/pack-*.bitmap) && + test_path_is_file "$pack_bitmap" && + + test_commit tip && + GIT_TEST_MULTI_PACK_INDEX=0 git repack -bm && + + test_path_is_file $midx && + test_path_is_file $midx-$(midx_checksum $objdir).bitmap && + test_path_is_missing $pack_bitmap + ) +' + test_expect_success TTY '--quiet disables progress' ' test_terminal env GIT_PROGRESS_DELAY=0 \ git -C midx repack -ad --quiet --write-midx 2>stderr && |
