#!/bin/sh
# Mosaic queue guard (docs 8.12). Installed as .git/hooks/pre-commit by
# `scripts/queue-commit.sh --install-hook`; never edit the installed copy.
# It refuses any commit whose index entries for the queue's two files differ
# from HEAD's. Only scripts/queue-commit.sh commits them, through
# commit-tree, which runs no hooks. Any failure of the check refuses too.
if git diff --cached --quiet HEAD -- docs/plans/queue.json docs/plans/QUEUE.md; then
    exit 0
fi
echo "mosaic queue guard: refused: this commit would change docs/plans/queue.json or docs/plans/QUEUE.md; only scripts/queue-commit.sh commits them" >&2
echo "fix: git reset -q -- docs/plans/queue.json docs/plans/QUEUE.md" >&2
exit 1
