From da7dc936d643f1537415332cbfbb654306d34a9c Mon Sep 17 00:00:00 2001 From: autocommit Date: Sat, 16 May 2026 20:38:12 -0700 Subject: [PATCH] =?UTF-8?q?feat(scripts):=20=E2=9C=A8=20Add=20LFS=20pointe?= =?UTF-8?q?r=20handling=20and=20on-demand=20blob=20fetching=20to=20improve?= =?UTF-8?q?=20archive=20extraction=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- scripts/extract-archive.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/extract-archive.sh b/scripts/extract-archive.sh index b436bc9..3519f4b 100755 --- a/scripts/extract-archive.sh +++ b/scripts/extract-archive.sh @@ -4,6 +4,10 @@ # Example: ./scripts/extract-archive.sh platform.1 # # Available versions: see `.archive/*.tar.zst` +# +# If the archive is an LFS pointer (small file, ~130B) rather than the real +# tarball, this script will git-lfs-pull it on demand so a fresh clone with +# GIT_LFS_SKIP_SMUDGE=1 doesn't need to pre-fetch 34G of archives. set -euo pipefail @@ -39,6 +43,16 @@ if [ ! -f "$ARCHIVE" ]; then usage fi +# If the file is tiny, it's an LFS pointer — fetch the real blob. +size=$(stat -c %s "$ARCHIVE" 2>/dev/null || stat -f %z "$ARCHIVE") +if [ "$size" -lt 1024 ]; then + echo "archive is an LFS pointer (${size}B); fetching real blob via git lfs pull..." + (cd "$REPO_ROOT" && git lfs pull --include=".archive/${VERSION}.tar.zst") || { + echo "error: git lfs pull failed. Is the LFS remote configured?" >&2 + exit 1 + } +fi + if [ -d "$DEST" ]; then echo "destination exists: $DEST" read -rp "remove and re-extract? [y/N] " ans