You've already forked tribes-supertest
381fb95eac
Replace the ignored devenv-generated pre-commit symlink with a tracked PATH-based prek config and local large-file hook so both devenv and Guix shells can run commit and push hooks.
39 lines
602 B
Bash
Executable File
39 lines
602 B
Bash
Executable File
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
maxkb=500
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
--maxkb=*)
|
|
maxkb=${1#--maxkb=}
|
|
shift
|
|
;;
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
-*)
|
|
echo "check-added-large-files: unknown option: $1" >&2
|
|
exit 2
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
limit=$((maxkb * 1024))
|
|
failed=0
|
|
|
|
for file in "$@"; do
|
|
[ -f "$file" ] || continue
|
|
size=$(wc -c < "$file" | tr -d '[:space:]')
|
|
if [ "$size" -gt "$limit" ]; then
|
|
kb=$(((size + 1023) / 1024))
|
|
echo "$file (${kb} KB) exceeds ${maxkb} KB" >&2
|
|
failed=1
|
|
fi
|
|
done
|
|
|
|
exit "$failed"
|