all repos — shwarp.ca @ 76d2a958ccf40d67523eeb49ded125704298957f

Homepage repo

chore(git): add pre-commit hook to check for page changes

These need to be in the built image or else internal navigation will fail.

Also word to the wise, if you have a global pre-commit hook, it will
supercede this one. Git hooks are NOT additive. If you want to use this
you must 1) mv it to your local git hooks:

    cp ./config/git/hooks/pre-commit -- .palestine/will/be/free/

And set your local repo to use local git hooks (sorry):

    git config --local core.hookspath .git/hooks

If you find a nicer way, please let me know.
shwarp
Wed, 04 Nov 2026 21:40:43 -0500
commit

76d2a958ccf40d67523eeb49ded125704298957f

parent

307072233dcc55d0b2302f4674e5f1bfecda6675

1 files changed, 29 insertions(+), 0 deletions(-)

jump to
A config/git/hooks/pre-commit

@@ -0,0 +1,29 @@

+#!/bin/bash + +# Redirect output to stderr. +exec 1>&2 + +# Allows us to read user input below, assigns stdin to keyboard +exec < /dev/tty + +function prompt { + while true; do + read -p "$1 [y]es or [n]o " yn + case $yn in + [Yy]* ) return 0;; + [Nn]* ) return 1;; + * ) echo "Please answer yes or no.";; + esac + done +} + +./scripts/gen-nginx-rewrites > ./config/pages.redirects + +git diff --exit-code ./config/pages.redirects +if [[ $? -ne 0 ]] +then + echo "You forgot to generate page redirects..." + prompt "Commit anyway?" || exit 1 +fi + +exit 0