git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] 2.56.0: filtered --unshallow of a moved ref aborts in pack-objects (should_include_obj) via inherited GIT_SHALLOW_FILE

From
DZDaniel Zoghalchali <daniel@latchkey.dev>
Date
Oct 24, 2026, 17:59 UTC
Message-ID
<CAJwQ=KQynymg4CJOLkyebACYVQa+LhXB2UifniTASkLyArWejA@mail.gmail.com>
Hi,

Since v2.56.0, a fetch that combines a tree filter with --unshallow (or --deepen) aborts in a non-partial shallow clone when the fetched ref has moved past the local tip:

  BUG: builtin/pack-objects.c:5098: should_include_obj should only be
called on existing objects
  error: pack-objects died of signal 6
  fatal: could not finish pack-objects to repack local links
  fatal: index-pack failed

v2.55.0 completes the same fetch. We hit it in CI, where a job checks out a single commit at depth 1 and then unshallows its branch, which by then has moved on.

Reproduction (offline, any Linux):
  set -e
  W=$(mktemp -d); cd "$W"
  git init -q -b dev seed
  for i in 1 2 3 4; do
    mkdir -p seed/src; echo "$i" > seed/src/f.txt
    git -C seed add -A
    git -C seed -c user.name=t -c user.email=t@t \
      commit -q -m "c$i"
  done
  git init -q --bare o.git
  git -C seed push -q "$W/o.git" dev
  git -C o.git config uploadpack.allowFilter true
  git -C o.git config uploadpack.allowAnySHA1InWant true
  git init -q co
  git -C co remote add origin "file://$W/o.git"
  TIP1=$(git -C seed rev-parse dev~1)
  git -C co fetch -q --no-tags --depth=1 origin \
    "+$TIP1:refs/remotes/origin/dev"
  git -C co checkout -q -B dev refs/remotes/origin/dev
  git -C co fetch --no-tags --filter=tree:0 --unshallow origin \
    +refs/heads/dev:refs/remotes/origin/dev

The last command dies as above with 2.56.0, both Ubuntu 24.04's git-core PPA build (1:2.56.0-0ppa1~ubuntu24.04.2) and v2.56.0 built from source. It succeeds with v2.55.0 built from source. With 2.56.0 it also succeeds when dev has not moved past the checkout, with --filter=blob:none, or without a filter. --deepen=N with the same filter aborts the same way.

What happens:
- fetch-pack runs "git --shallow-file '' index-pack --promisor ...".
- The pack names the local tip as the parent of the new dev commit, so
  index-pack's repack_local_links() starts "git pack-objects
  --exclude-promisor-objects-best-effort".
- Since d43b9acb05 (setup: unify setup of shallow file), --shallow-file
  is applied by exporting GIT_SHALLOW_FILE, so that grandchild inherits
  the empty shallow file.
- The grandchild no longer treats the local tip as a shallow boundary.
  It walks to the tip's parent, a promisor commit fetched without trees,
  and is_not_in_promisor_pack_obj() hits the BUG on that parent's
  missing root tree.
- Before d43b9acb05, the grandchild read $GIT_DIR/shallow and stopped at
  the tip.

To confirm this, we wrapped only the repack child. Unsetting GIT_SHALLOW_FILE for it makes 2.56.0 pass, and setting GIT_SHALLOW_FILE= for it makes 2.55.0 fail the same way, at its builtin/pack-objects.c:5004.

Separately, the BUG() is reachable without the environment change. On 2.55.0, a filtered --unshallow of the local tip, followed by a filtered fetch of a moved ref, also dies there, because the walk from the local tip reaches promisor commits whose trees were never fetched.

Thanks, Daniel Zoghalchali

Next: Patrick Steinhardt
Message 1 of 3 in “[BUG] 2.56.0: filtered --unshallow of a moved ref aborts in pack-objects (should_include_obj) via inherited GIT_SHALLOW_FILE”
  1. Daniel ZoghalchaliOct 24, 2026
  2. Patrick SteinhardtOct 26, 2026
  3. Patrick SteinhardtOct 27, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.