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()