@@ -256,19 +256,32 @@ jobs:
256256 done
257257
258258 # fetch-depth: 0 makes actions/checkout do a blobless partial clone
259- # (--filter=blob:none) - commits and trees only, no file contents. Real git
260- # transparently lazy-fetches a missing blob on demand (e.g. from `git cat-file`),
261- # but antora's isomorphic-git has no concept of that and just fails outright -
262- # this is the actual NotFoundError root cause, not --fetch. A plain fetch here
263- # inherits that same filter from the remote config, so clear it and use
264- # --refetch to force these branches' blobs down for real, not just their commits
265- # and trees. The unsets are harmless no-ops (exit 5) when there was no partial
266- # clone filter to begin with, hence `|| true`.
267- git config --unset remote.origin.partialclonefilter 2>/dev/null || true
268- git config --unset remote.origin.promisor 2>/dev/null || true
269- # no --depth: a shallow/grafted commit here seems to confuse antora's own
270- # isomorphic-git fetch when it later tries to resolve these same branches
271- git fetch --no-tags --refetch origin "${refspecs[@]}"
259+ # (--filter=blob:none) - commits and trees only, no file contents. antora reads
260+ # each branch from the git object store via isomorphic-git, which (a) can't
261+ # lazy-fetch a missing blob the way real git does, and (b) loads a whole packfile
262+ # into memory to read it, so it chokes on a very large pack (readSlice -> null,
263+ # "Cannot read properties of null (reading 'slice')"). `git fetch --refetch` here
264+ # avoided (a) but caused (b): it re-downloads the FULL history and ALL blobs of
265+ # every branch (gigabytes on big repos) into one pack isomorphic-git can't read.
266+ #
267+ # Instead, get the branches' commits/trees (cheap, still blobless) so the refs
268+ # resolve, then hydrate ONLY the blobs antora needs by checking out each branch
269+ # tip. Because actions/checkout above set sparse-checkout to DOCS_DIR, each
270+ # checkout batch-fetches just DOCS_DIR's blobs for that tip from the promisor
271+ # remote - keeping the object store small (tens of MB) and isomorphic-git-readable.
272+ # Finally restore the worktree/HEAD to the ref we built from.
273+ #
274+ # NOTE: this assumes every LOCAL content source's start_path is within the
275+ # sparse-checkout set (DOCS_DIR / SPARSE_CHECKOUT_EXTRA_PATHS). A local source
276+ # outside it would not be hydrated. Remote-url sources are antora's to fetch.
277+ git config core.commitGraph false # avoid commit-graph/promisor desync during hydration
278+ git fetch --no-tags origin "${refspecs[@]}"
279+
280+ build_ref_head="$(git rev-parse HEAD)"
281+ for branch in $branches; do
282+ git checkout -q --detach "refs/remotes/origin/${branch}"
283+ done
284+ git checkout -q --detach "$build_ref_head"
272285
273286 - name : Remove excluded extensions
274287 run : |
0 commit comments