chore: clean .gitignore cache
This commit is contained in:
20
scripts/pre-commit-hooks/block-data-backups-commit.sh
Executable file
20
scripts/pre-commit-hooks/block-data-backups-commit.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Prevent committing any files under data/backups/ accidentally
|
||||
staged_files=$(git diff --cached --name-only || true)
|
||||
if [ -z "$staged_files" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for f in $staged_files; do
|
||||
case "$f" in
|
||||
data/backups/*)
|
||||
echo "Error: Committing files under data/backups/ is blocked. Remove them from the commit and re-run." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user