ludic/tools/git-hooks/pre-commit
Orkuncakilkaya 985f9ad8f2 Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete
Self-hosted compiler (selfhost/*.ludic), runtime, examples, editor tooling,
and docs. Phase 1 of the syntax-redesign cohesion pass has landed:
edge-system fix, signature-query, when-alias, and the documentation truth-pass.
Suite green (14/14), C-free bootstrap fixpoint holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-27 15:15:35 +03:00

29 lines
873 B
Bash
Executable file

#!/bin/sh
# Reject a commit that contains unformatted Ludic — in source or in the ```ludic
# fences of a Markdown file.
#
# ln -sf ../../tools/git-hooks/pre-commit .git/hooks/pre-commit
#
# Checks only the files being committed, so it stays fast on a big tree.
set -e
ROOT=$(git rev-parse --show-toplevel)
FMT="$ROOT/build/ludic-fmt"
[ -x "$FMT" ] || exit 0 # toolchain not built: do not block the commit
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ludic|md|markdown)$' || true)
[ -z "$FILES" ] && exit 0
UNFORMATTED=""
for f in $FILES; do
[ -f "$ROOT/$f" ] || continue
"$FMT" --check -q "$ROOT/$f" >/dev/null 2>&1 || UNFORMATTED="$UNFORMATTED $f"
done
if [ -n "$UNFORMATTED" ]; then
echo "unformatted Ludic:"
for f in $UNFORMATTED; do echo " $f"; done
echo
echo "fix with: build/ludic-fmt -w$UNFORMATTED"
exit 1
fi