mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-08-26 11:01:13 +00:00
chore: lock in nph version and add pre-commit hook (#2938)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Running pre-commit hook"
|
||||
|
||||
# Regexp for grep to only choose some file extensions for formatting
|
||||
exts="\.\(nim\|nims\)$"
|
||||
|
||||
# Build nph lazily
|
||||
make build-nph || (1>&2 echo "failed to build nph. Pre-commit formatting will not be done."; exit 0)
|
||||
|
||||
# Format staged files
|
||||
git diff --cached --name-only --diff-filter=ACMR | grep "$exts" | while read file; do
|
||||
echo "Formatting $file"
|
||||
make nph/"$file"
|
||||
git add "$file"
|
||||
done
|
||||
Reference in New Issue
Block a user