On Tue, Oct 27, 2026 at 08:00:28AM +0100, Patrick Steinhardt wrote:
> This bug can trigger in situations where we have e.g. a combination of
> shallow and partial clones, [...]
The BUG occurs with no moved ref, in a depth-2 clone of a merge
commit. A CI job in one repository ran this fetch after a
depth-2 checkout of a pull request's merge commit:
set -e
export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=…@example.com
export GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=…@example.com
cd "$(mktemp -d)"
git init -q -b main origin
cd origin
git config uploadpack.allowFilter true
echo root >f && git add f && git commit -q -m root
echo main >f && git commit -q -am main1
git checkout -q -b side
echo 1 >s && git add s && git commit -q -m side1
echo 2 >s && git commit -q -am side2
git checkout -q main
git merge -q --no-ff -m merge side
cd ..
git clone -q --depth 2 "file://$PWD/origin" clone
git -C clone fetch --filter=tree:0 --unshallow origin
Exit status of the last command:
d43b9acb05^ 0
d43b9acb05 128, BUG at pack-objects.c:5004
v2.56.1 128, BUG at pack-objects.c:5098
master (acba8bf975) 128, BUG at pack-objects.c:5139
v2.56.1 with this patch 0, and "git fsck" exits 0
master with v5 of [1] 0, and "git fsck" exits 0
On v2.56.1 the fetch exits 0 in each of these cases:
- --filter=blob:none in place of --filter=tree:0
- no filter
- side has one commit
- side forks from root
[1] <pull…@gmail.com>
Tested-by: Sami Jawhar <sa…@theorem.dev>