Files
Battle-for-Tismo/scripts/install-git-hooks.sh
T
adrien f3e94a3d53 Added the devlog, fixed the map labels and reworked joining
- Political map country names were invisible because the label SVG had a zero-sized viewport, which some browsers never paint; size it to the world and guard it with a test.
- Added a Devlog button showing the ten latest commits, generated into client/js/devlog_data.js by scripts/generate-devlog.js and refreshed by the pre-commit hook.
- Worked through FIXME.md: the city button and a unit double-click now open the city, and the stat tooltip escapes the HUD so the unit panel cannot cover it.
- The server creates its game at startup and clients only join it; the Create game screen and the configure_game path are gone, and testing is a --testing server flag.
- A page on a loopback host signs in as adrien, claims France and gets the free, instant testing buttons, while the server grants free orders only to a loopback socket whose Origin is also loopback.
2026-09-21 23:08:05 +02:00

45 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# Install the versioned git hooks for this repository by pointing core.hooksPath
# at the githooks directory. This is a one-time, per-checkout setup:
#
# ./scripts/install-git-hooks.sh
#
# After this, every `git commit` runs the test suite first and aborts if it
# fails, then refreshes the generated devlog (client/js/devlog_data.js) and
# stages it. Skip once with `git commit --no-verify`.
#
# Uninstall with:
# git config --unset core.hooksPath
set -e
PROJECT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
HOOKS_DIR="$PROJECT_DIR/githooks"
if [ ! -d "$HOOKS_DIR" ]; then
echo "error: hooks directory not found at $HOOKS_DIR" >&2
exit 1
fi
REPO_ROOT=$(git -C "$PROJECT_DIR" rev-parse --show-toplevel 2>/dev/null) || {
echo "error: $PROJECT_DIR is not inside a git repository." >&2
echo " Run 'git init' first, then re-run this script." >&2
exit 1
}
# Git only runs hooks that are executable.
chmod +x "$HOOKS_DIR"/*
# core.hooksPath is local (not committed), so each clone runs this once.
git -C "$REPO_ROOT" config core.hooksPath "$HOOKS_DIR"
echo "Installed git hooks from $HOOKS_DIR"
echo " repository: $REPO_ROOT"
echo " core.hooksPath $HOOKS_DIR"
if ! command -v node >/dev/null 2>&1 && command -v nix-shell >/dev/null 2>&1; then
echo " note: 'node' is not on PATH; the hook will fall back to 'nix-shell -p nodejs'."
fi
echo ""
echo "Every commit now runs the test suite and refreshes the devlog."
echo "Skip once with: git commit --no-verify"