#!/bin/sh
# BEGIN COMMITGUARD
# This block is managed by CommitGuard. Do not edit it: `commitguard doctor`
# detects changes and `commitguard install` restores it. `commitguard uninstall`
# removes it and restores any hook preserved during installation.
# commitguard-hook: commit-msg
# commitguard-format: 1
# commitguard-checksum: sha256:31446d80521020e2064d43e4d2fe605141578a747ab0c6e934a93f67fddf8786
commitguard_hook='commit-msg'
commitguard_python=''
commitguard_chained="$(dirname -- "$0")/commit-msg.pre-commitguard"

commitguard_run() {
    if [ -n "$commitguard_python" ] && [ -f "$commitguard_python" ]; then
        "$commitguard_python" -P -m commitguard hook "$commitguard_hook" "$@"
    elif command -v commitguard >/dev/null 2>&1; then
        commitguard hook "$commitguard_hook" "$@"
    else
        echo "CommitGuard is not available." >&2
        echo "The repository's $commitguard_hook security hook could not execute." >&2
        echo "Operation blocked because the security check could not be completed." >&2
        echo "Run: commitguard doctor   (reinstall hooks with: commitguard install)" >&2
        return 2
    fi
}

commitguard_run "$@" || exit $?
if [ -x "$commitguard_chained" ]; then
    "$commitguard_chained" "$@" || exit $?
fi
# END COMMITGUARD
