feat(scripts): ✨ Add LFS pointer handling and on-demand blob fetching to improve archive extraction performance
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
9bef29094c
commit
da7dc936d6
1 changed files with 14 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue