]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'tb/midx-no-bitmap-for-no-objects'
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Feb 2022 21:53:30 +0000 (13:53 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Feb 2022 21:53:30 +0000 (13:53 -0800)
When there is no object to write .bitmap file for, "git
multi-pack-index" triggered an error, instead of just skipping,
which has been corrected.

* tb/midx-no-bitmap-for-no-objects:
  midx: prevent writing a .bitmap without any objects

1  2 
midx.c
t/t5326-multi-pack-bitmaps.sh

diff --cc midx.c
Simple merge
index 3c1ecc7e25017399381d581258d3d0817a5f4b1b,89b5d45c483acb55200079e3e6f384557c1354cb..4fe57414c13caca90d862b417ad5471cab28ee12
@@@ -266,23 -395,26 +266,45 @@@ test_expect_success 'hash-cache values 
        )
  '
  
+ test_expect_success 'no .bitmap is written without any objects' '
+       rm -fr repo &&
+       git init repo &&
+       test_when_finished "rm -fr repo" &&
+       (
+               cd repo &&
+               empty="$(git pack-objects $objdir/pack/pack </dev/null)" &&
+               cat >packs <<-EOF &&
+               pack-$empty.idx
+               EOF
+               git multi-pack-index write --bitmap --stdin-packs \
+                       <packs 2>err &&
+               grep "bitmap without any objects" err &&
+               test_path_is_file $midx &&
+               test_path_is_missing $midx-$(midx_checksum $objdir).bitmap
+       )
+ '
 +test_expect_success 'graceful fallback when missing reverse index' '
 +      rm -fr repo &&
 +      git init repo &&
 +      test_when_finished "rm -fr repo" &&
 +      (
 +              cd repo &&
 +
 +              test_commit base &&
 +
 +              # write a pack and MIDX bitmap containing base
 +              git repack -adb &&
 +              git multi-pack-index write --bitmap &&
 +
 +              GIT_TEST_MIDX_READ_RIDX=0 \
 +                      git rev-list --use-bitmap-index HEAD 2>err &&
 +              ! grep "ignoring extra bitmap file" err
 +      )
 +'
 +
  test_done