Move ensureCleanWorkingDirectory to own function

This commit is contained in:
Sven van Heugten 2026-05-12 08:08:58 +02:00
parent 2dc2c288fb
commit c6996d5bbf
No known key found for this signature in database
GPG key ID: D612F88666F4F660

View file

@ -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 <path/to/project.csproj|fsproj>"
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()