From 6728ffeee871df5e7b4433463c3f751621b59ef1 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Tue, 12 May 2026 06:37:08 +0200 Subject: [PATCH] Refuse to run if git repo is dirty --- Mutannot/Mutannot.fsproj | 1 + Mutannot/Program.fs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Mutannot/Mutannot.fsproj b/Mutannot/Mutannot.fsproj index cd3d012..7c6381b 100644 --- a/Mutannot/Mutannot.fsproj +++ b/Mutannot/Mutannot.fsproj @@ -11,6 +11,7 @@ + diff --git a/Mutannot/Program.fs b/Mutannot/Program.fs index 5b77edb..e7195fc 100644 --- a/Mutannot/Program.fs +++ b/Mutannot/Program.fs @@ -1,2 +1,17 @@ +open Fli + [] -let main argv = 0 +let main argv = + let gitState = + cli { + Exec "git" + Arguments [ "status"; "--porcelain" ] + } + |> Command.execute + |> Output.throwIfErrored + + if gitState.Text <> None then + eprintfn "Uncommitted changes. Refusing to run." + exit 1 + + 0