Brand new run dialogue. This hasn't been updated all that much since the days of Strychnine. It's time for some modernizations. I think it's much improved, but if y'all hate it let me know and I'll either fix or revert it.
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
cacheFiles=()
|
||||
while IFS= read -r stagedFile; do
|
||||
case "$stagedFile" in
|
||||
__pycache__/* | */__pycache__/* | *.pyc | *.pyo | *.pyd)
|
||||
cacheFiles+=("$stagedFile")
|
||||
;;
|
||||
esac
|
||||
done < <(git diff --cached --name-only --diff-filter=ACMR)
|
||||
|
||||
if [[ ${#cacheFiles[@]} -eq 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf 'Commit blocked: remove generated Python cache files from the index:\n' >&2
|
||||
printf ' %s\n' "${cacheFiles[@]}" >&2
|
||||
printf '\nUse git rm --cached -- <file> to unstage forced additions.\n' >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user