summaryrefslogtreecommitdiff
path: root/.githooks/pre-commit
blob: 220fc1914294f0eb3b4c192ca3d225bc8ec8d39b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# .githooks/pre-commit
# This repo is checked out on Windows, which doesn't reliably preserve
# the executable bit (that's why core.fileMode is false - see
# statuspage/README.md). Without this hook, a newly-added *.sh file
# silently stages as non-executable, and render.sh skips non-executable
# files with no error - a broken check script wouldn't even show up as
# a down/warn row, it'd just vanish.
#
# Force +x on every staged *.sh file so that can't happen.
git diff --cached --name-only --diff-filter=ACM -- '*.sh' | while IFS= read -r f; do
    git update-index --chmod=+x "$f"
done