Setup repo with Phi 3

This commit is contained in:
zcourts
2025-09-27 18:26:34 +01:00
commit 0c748f1497
16 changed files with 1122 additions and 0 deletions

49
tools/cleanup.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail
# cleanup.sh - Commits, pushes, and prunes LFS files.
#
# - Detects *untracked* files (git status --porcelain), so we dont skip commits.
# - Uses 'git add --renormalize .' so new/changed .gitattributes rules convert
# existing files into LFS pointers on re-add.
# - Keeps the prune step to free local disk space after a successful push.
#
# Usage: ./tools/cleanup.sh <commit-message>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <commit-message>" >&2
exit 1
fi
COMMIT_MESSAGE="$1"
# Detect any changes, including untracked.
if [[ -z "$(git status --porcelain=v1)" ]]; then
echo "No new files or changes to commit. Skipping commit and push."
exit 0
fi
echo "Committing and pushing changes..."
# Make sure .gitattributes changes are included and normalization runs,
# so LFS filters rewrite eligible files as pointers.
git add .gitattributes || true
git add --renormalize .
# If nothing ended up staged (e.g. only ignored files changed), exit gracefully.
if git diff --cached --quiet; then
echo "No staged changes after normalization. Skipping commit and push."
exit 0
fi
git commit -m "$COMMIT_MESSAGE"
git push
# Optional but useful: ensure all LFS objects are on the remote.
# Uncomment if you want belt-and-suspenders uploads.
# git lfs push origin --all
echo "Pruning local LFS files..."
git lfs prune --force
echo "✅ Cleanup complete."