Keep weights out of Gitea
This commit is contained in:
21
scripts/check_no_weight_git.sh
Executable file
21
scripts/check_no_weight_git.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
tracked_weights="$(git ls-files | grep -E '(^weights/files/|\.pt$|\.pth$|\.onnx$|\.engine$)' || true)"
|
||||
if [[ -n "${tracked_weights}" ]]; then
|
||||
echo "ERROR: weight files are tracked by git and must not be pushed to Gitea:" >&2
|
||||
echo "${tracked_weights}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
staged_weights="$(git diff --cached --name-only | grep -E '(^weights/files/|\.pt$|\.pth$|\.onnx$|\.engine$)' || true)"
|
||||
if [[ -n "${staged_weights}" ]]; then
|
||||
echo "ERROR: weight files are staged and must not be pushed to Gitea:" >&2
|
||||
echo "${staged_weights}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: no weight files are tracked or staged for Gitea."
|
||||
Reference in New Issue
Block a user