@echo off REM Pre-commit test gate for Windows REM Inspects staged .rs files and runs affected crate tests setlocal enabledelayedexpansion REM Get staged .rs files set STAGED_FILES= for /f "delims=" %%f in ('git diff --cached --name-only --diff-filter=ACMR -- "*.rs"') do ( if exist "%%f" set STAGED_FILES=!STAGED_FILES! %%f ) if "%STAGED_FILES%"=="" ( echo No staged Rust files; commit regression tests are not required. exit /b 0 ) echo Checking formatting... for %%f in (%STAGED_FILES%) do ( rustfmt --edition 2021 --check "%%f" if errorlevel 1 ( echo Formatting check failed for %%f exit /b 1 ) ) echo Running deterministic workspace tests... cargo check --locked --workspace --exclude hcie-io --examples if errorlevel 1 exit /b %errorlevel% cargo test --locked --workspace --exclude hcie-io --lib --tests -- --skip benchmark_4k_stroke_on_multilayer_document if errorlevel 1 exit /b %errorlevel% echo Mandatory Rust regression gate passed. exit /b 0