userland: do not check out refs/ with the submodules

The reference trees are tens of gigabytes (the Linux kernel alone) and no
build step reads them: srctree-stage.sh keeps them out of the source set.  A
fresh clone's `make release` pulled 36 GB before the timeout (measured
2026-11-23).  refs/ is filtered out; the rest of the pinned submodules are
checked out.
This commit is contained in:
lotherk committed 2026-11-23 13:53:57 +00:00
1 parent 7b02c454f6
commit c80760883f
1 file changed
+7 -1
+7 -1
View File
@@ -439,8 +439,14 @@ ensure_submodules()
# checked out, '+' for one at the wrong commit, ' ' for the pinned one.
# (The prefix is glued to the hash, so the test is on the first character
# of the line, not on a field.)
#
# refs/ is left out: those are reference trees (the Linux kernel alone is
# tens of gigabytes) that tools/srctree-stage.sh keeps out of the source
# set and no build step reads. Checking them out turned a fresh clone's
# `make release` into a 36 GB download (measured 2026-11-23).
need=$(cd "$TOP" && git submodule status 2>/dev/null |
awk 'substr($0, 1, 1) == "-" || substr($0, 1, 1) == "+" { print $2 }')
awk 'substr($0, 1, 1) == "-" || substr($0, 1, 1) == "+" { print $2 }' |
grep -v '^refs/')
[ -n "$need" ] || return 0
echo "userland: submodules at their pin: $(echo $need)"
# A submodule that cannot be fetched (a private tree this build does not