diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit index 163a964..c35df39 100755 --- a/scripts/hooks/pre-commit +++ b/scripts/hooks/pre-commit @@ -37,8 +37,12 @@ if ! command -v emacs >/dev/null 2>&1; then exit 0 fi +# Keep this list in step with SCOPE in scripts/reindent.sh. They are two copies +# of one decision, and they have already disagreed once: `tools` and `examples` +# arrived with the documentation harness and were reindentable by hand while +# neither this hook nor `--check` could see them. staged=$(git diff --cached --name-only --diff-filter=ACMR \ - | grep -E '^(src|include|tests|util)/.*\.[ch]$' \ + | grep -E '^(src|include|tests|util|tools|examples)/.*\.[ch]$' \ | grep -v -x -F 'include/akgl/SDL_GameControllerDB.h' || true) if [ -z "$staged" ]; then diff --git a/scripts/reindent.sh b/scripts/reindent.sh index 2dc67af..3d2b2f8 100755 --- a/scripts/reindent.sh +++ b/scripts/reindent.sh @@ -19,7 +19,13 @@ elisp="$root/scripts/reindent.el" # Directories whose C sources are hand-maintained. Anything outside these is # vendored (deps/) or generated (include/akgl/SDL_GameControllerDB.h) and is # left alone. -SCOPE='src include tests util' +# +# `tools` and `examples` joined the list with the documentation harness. Both +# hold ordinary hand-written C -- the doc-example validators and the two +# tutorial games -- and while they were outside the scope neither `--check` nor +# the pre-commit hook could see them, so the one thing that keeps this tree a +# fixed point of `indent-region` was not being applied to its newest sources. +SCOPE='src include tests util tools examples' GENERATED='include/akgl/SDL_GameControllerDB.h' check=0