From: Patrick Steinhardt Date: Wed, 28 Jan 2026 08:49:19 GMT Subject: [PATCH 0/3] Fix misuse of `refs_for_each_ref_in()` Message-ID: <20260128-b4-pks-fix-for-each-ref-in-misuse-v1-0-deccae3ea725@pks.im> Hi, this small patch series fixes a bug I have discovered where configuring "pack.preferBitmapTips" to an exact branch will cause Git to `BUG()`. The root cause of this bug is misuse of `refs_for_each_ref_in()`: this function accepts a prefix to yield refs for, and then strips the prefix for each ref. Consequently, if passed an exact refname, then stripping the prefix would make us end up with an empty refname, and that is not supposed to happen. There was one other caller that got it wrong, too, and which is also fixed in this patch series. Thanks! Patrick --- Patrick Steinhardt (3): pack-bitmap: deduplicate logic to iterate over preferred bitmap tips pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips" bisect: fix misuse of `refs_for_each_ref_in()` bisect.c | 8 ++++---- builtin/pack-objects.c | 19 ++----------------- pack-bitmap.c | 18 +++++++++++++++++- pack-bitmap.h | 9 ++++++++- repack-midx.c | 14 +++----------- t/t5310-pack-bitmaps.sh | 35 +++++++++++++++++++++++++++++++++++ t/t5319-multi-pack-index.sh | 36 ++++++++++++++++++++++++++++++++++++ 7 files changed, 105 insertions(+), 34 deletions(-) --- base-commit: ea717645d199f6f1b66058886475db3e8c9330e9 change-id: 20260128-b4-pks-fix-for-each-ref-in-misuse-96ae62e313a5