#!/bin/sh
# ReFineID Windows commit gate.
#
# Rejects a commit that would fail the formatting contract in CONTRIBUTING.md.
# Enable it once per clone with:
#
#     git config core.hooksPath .githooks
#
# Formatting is cheap and cross-platform, so both formatters run here on every
# host: rustfmt for Rust and CSharpier for C#, XAML, and the project files. The
# heavier semantic checks -- clippy (needs the Windows-only crates) and the
# WinUI build -- run in CI (.github/workflows/ci.yml), which is the
# authoritative push gate. Bypass in a genuine emergency with
# `git commit --no-verify`.

set -e

echo "pre-commit: cargo fmt --all --check"
cargo fmt --all --check

echo "pre-commit: dotnet csharpier check"
dotnet tool restore >/dev/null
dotnet csharpier check .

echo "pre-commit: ok (clippy and the WinUI build run in CI)"
