#!/bin/sh
# Auto-generate a HISTORY.md entry on [release] commits.
#
# This is a thin shim; all logic lives in (and is versioned as)
# scripts/gen_changelog_entry.py. Install it with:
#
#   cp .githooks/commit-msg .git/hooks/commit-msg
#
# The script is a no-op unless the commit message contains [release], and it
# always exits 0 so it can never block a commit.
ROOT="$(git rev-parse --show-toplevel)"
SCRIPT="$ROOT/scripts/gen_changelog_entry.py"
[ -f "$SCRIPT" ] || exit 0
if command -v python >/dev/null 2>&1; then
  python "$SCRIPT" "$1"
elif command -v py >/dev/null 2>&1; then
  py -3 "$SCRIPT" "$1"
fi
exit 0
