Reindent tools/ and examples/ too, in both copies of the scope list
`scripts/reindent.sh` and `scripts/hooks/pre-commit` each carried their own copy of the directory list, and neither included `tools` or `examples`. Both hold ordinary hand-written C, so `--check` reported a clean tree without having looked at them and the hook let them through unformatted -- which defeats the one thing that keeps this tree a fixed point of `indent-region`. The comment in `reindent.sh` already said the scope is "directories whose C sources are hand-maintained", so this is the list catching up with the stated intent rather than a new policy. The two copies are now marked as being two copies of one decision, because they have already disagreed once and nothing detects it when they do. `scripts/reindent.sh --check` is clean with the wider scope. Co-Authored-By: Claude Code <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
@@ -37,8 +37,12 @@ if ! command -v emacs >/dev/null 2>&1; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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 \
|
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)
|
| grep -v -x -F 'include/akgl/SDL_GameControllerDB.h' || true)
|
||||||
|
|
||||||
if [ -z "$staged" ]; then
|
if [ -z "$staged" ]; then
|
||||||
|
|||||||
@@ -19,7 +19,13 @@ elisp="$root/scripts/reindent.el"
|
|||||||
# Directories whose C sources are hand-maintained. Anything outside these is
|
# Directories whose C sources are hand-maintained. Anything outside these is
|
||||||
# vendored (deps/) or generated (include/akgl/SDL_GameControllerDB.h) and is
|
# vendored (deps/) or generated (include/akgl/SDL_GameControllerDB.h) and is
|
||||||
# left alone.
|
# 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'
|
GENERATED='include/akgl/SDL_GameControllerDB.h'
|
||||||
|
|
||||||
check=0
|
check=0
|
||||||
|
|||||||
Reference in New Issue
Block a user