From c6996d5bbfd406ec6f792e69ec807d26ef55a154 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Tue, 12 May 2026 08:08:58 +0200 Subject: [PATCH] Move ensureCleanWorkingDirectory to own function --- Mutannot/Program.fs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Mutannot/Program.fs b/Mutannot/Program.fs index 6cd78aa..5c3f6be 100644 --- a/Mutannot/Program.fs +++ b/Mutannot/Program.fs @@ -6,6 +6,19 @@ open Fli type MutationCase = { TestName: string; Patch: string } +let ensureCleanWorkingDirectory () = + let gitState = + cli { + Exec "git" + Arguments [ "status"; "--porcelain" ] + } + |> Command.execute + |> Output.throwIfErrored + + if gitState.Text <> None then + eprintfn "Uncommitted changes. Refusing to run." + exit 2 + let ensureBuilt projectPath = cli { Exec "dotnet" @@ -70,20 +83,10 @@ let main argv = eprintfn "Usage: mutannot " exit 1 + ensureCleanWorkingDirectory () + let projectPath = argv[0] - let gitState = - cli { - Exec "git" - Arguments [ "status"; "--porcelain" ] - } - |> Command.execute - |> Output.throwIfErrored - - if gitState.Text <> None then - eprintfn "Uncommitted changes. Refusing to run." - exit 2 - for mutationCase in getMutationCases projectPath do printfn "%s" <| mutationCase.ToString()