While starting to use multi-pack reuse in more places throughout GitHub, I noticed a rare but persistent segfault, which is the result of a broken assumption in write_reused_pack_verbatim(). The first patch demonstrates the problem, and the second patch fixes it. The second patch explains the broken assumption in detail, but the gist is that we can't infer that an all-1s word in the reuse bitmap from a non-preferred pack means that we want all objects between the ones corresponding to the first and last bit. I'm fairly disappointed that I didn't catch this obviously-broken implementation during the original development of this feature, or in the first round of bugfixes. But these patches should conclusively resolve at least this issue. Thanks in advance for your review! Taylor Blau (2): t5332-multi-pack-reuse.sh: demonstrate duplicate packing failure pack-objects: only perform verbatim reuse on the preferred pack builtin/pack-objects.c | 101 +++++++++++++++--------------------- t/t5332-multi-pack-reuse.sh | 23 ++++++++ 2 files changed, 66 insertions(+), 58 deletions(-) base-commit: 25b0f41288718625b18495de23cc066394c09a92 -- 2.46.0.421.g159f2d50e75