From: Teng Long <dyroneteng@xxxxxxxxx> In "open_midx_bitmap_1()" and "open_pack_bitmap_1()", when we find that there are multiple bitmaps, we will only open the first one and then leave warnings about the remaining pack information, the information will contain the absolute path of the repository, for example in a alternates usage scenario. So let's hide this kind of potentially sensitive information in this commit. Found-by: XingXin <moweng.xx@xxxxxxxxxxxx> Signed-off-by: Teng Long <dyroneteng@xxxxxxxxx> --- pack-bitmap.c | 12 ++++++++---- t/t5310-pack-bitmaps.sh | 11 ++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index 36134222d7a..a8c76056637 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -331,8 +331,9 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, if (bitmap_git->pack || bitmap_git->midx) { struct strbuf buf = STRBUF_INIT; get_midx_filename(&buf, midx->object_dir); - /* ignore extra bitmap file; we can only handle one */ - warning("ignoring extra bitmap file: %s", buf.buf); + /* ignore extra midx bitmap files; we can only handle one */ + trace2_data_string("bitmap", the_repository, + "ignoring extra midx bitmap file", basename(buf.buf)); close(fd); strbuf_release(&buf); return -1; @@ -402,8 +403,9 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git } if (bitmap_git->pack || bitmap_git->midx) { - /* ignore extra bitmap file; we can only handle one */ - warning("ignoring extra bitmap file: %s", packfile->pack_name); + /* ignore extra bitmap files; we can only handle one */ + trace2_data_string("bitmap", the_repository, + "ignoring extra bitmap file", basename(packfile->pack_name)); close(fd); return -1; } @@ -428,6 +430,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git return -1; } + trace2_data_string("bitmap", the_repository, "opened bitmap file", + basename(packfile->pack_name)); return 0; } diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh index f775fc1ce69..614586b0181 100755 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@ -397,7 +397,7 @@ test_expect_success 'pack.preferBitmapTips' ' ) ' -test_expect_success 'complains about multiple pack bitmaps' ' +test_expect_success 'complains about multiple pack bitmaps when debugging by trace2' ' rm -fr repo && git init repo && test_when_finished "rm -fr repo" && @@ -420,8 +420,13 @@ test_expect_success 'complains about multiple pack bitmaps' ' test_line_count = 2 packs && test_line_count = 2 bitmaps && - git rev-list --use-bitmap-index HEAD 2>err && - grep "ignoring extra bitmap file" err + ls -tr .git/objects/pack | grep -e "^pack-.*\.pack$" > sorted-packs && + ignored_pack="$(cat sorted-packs | awk 'NR==1{print}')" && + open_pack="$(cat sorted-packs | awk 'NR==2{print}')" && + + GIT_TRACE2_PERF=1 git rev-list --use-bitmap-index HEAD 2>err && + grep "opened bitmap file:$opened_pack" err && + grep "ignoring extra bitmap file:$ignored_pack" err ) ' -- 2.37.2.1.g87a494e5ac0