diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5bef4132..3be8ce02 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", ve kotlin-collections-immutable = "org.jetbrains.kotlinx:kotlinx-collections-immutable:0.5.0" kotlin-serialization-json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0" kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } -ktfmt = "com.facebook:ktfmt:0.63" +ktfmt = "com.facebook:ktfmt:0.64" ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } ktor-client-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" } diff --git a/src/commonMain/kotlin/com/mattprecious/stacker/command/StackerCommand.kt b/src/commonMain/kotlin/com/mattprecious/stacker/command/StackerCommand.kt index 97c88130..6286ef48 100644 --- a/src/commonMain/kotlin/com/mattprecious/stacker/command/StackerCommand.kt +++ b/src/commonMain/kotlin/com/mattprecious/stacker/command/StackerCommand.kt @@ -60,18 +60,17 @@ abstract class StackerCommand { // Mosaic will wait for all effects to finish before exiting. Finished and Aborted signal that // we should terminate this collect in order to tear down. - val currentState = - remember { - snapshotFlow { workState.state } - .transformWhile { - // We need to emit the terminal state so that the LaunchedEffect below can be - // interrupted. - emit(it) - it !is State.TerminalState - } + val currentState = remember { + snapshotFlow { workState.state } + .transformWhile { + // We need to emit the terminal state so that the LaunchedEffect below can be + // interrupted. + emit(it) + it !is State.TerminalState } - .collectAsState(workState.state) - .value + } + .collectAsState(workState.state) + .value printer.Messages() diff --git a/src/commonMain/kotlin/com/mattprecious/stacker/vc/GitVersionControl.kt b/src/commonMain/kotlin/com/mattprecious/stacker/vc/GitVersionControl.kt index 1532d3ab..0c02fc34 100644 --- a/src/commonMain/kotlin/com/mattprecious/stacker/vc/GitVersionControl.kt +++ b/src/commonMain/kotlin/com/mattprecious/stacker/vc/GitVersionControl.kt @@ -407,38 +407,38 @@ class GitVersionControl(scope: MemScope, private val fs: FileSystem, private val private fun MemScope.getCommitForBranch(branchName: String): git_commit { return withAllocPointerTo { - checkError( - functionName = "git_commit_lookup", - result = git_commit_lookup(it.pointer, repo, getCommitId(branchName).pointer), - ) - } + checkError( + functionName = "git_commit_lookup", + result = git_commit_lookup(it.pointer, repo, getCommitId(branchName).pointer), + ) + } .pointed!! } private fun MemScope.getHead(): git_reference { return withAllocPointerTo { - checkError("git_repository_head", git_repository_head(it.ptr, repo)) - } + checkError("git_repository_head", git_repository_head(it.ptr, repo)) + } .pointed!! } private fun MemScope.getBranch(branchName: String): git_reference { return withAllocPointerTo { - checkError( - functionName = "git_reference_lookup", - result = git_reference_lookup(it.ptr, repo, branchName.asBranchRevSpec()), - ) - } + checkError( + functionName = "git_reference_lookup", + result = git_reference_lookup(it.ptr, repo, branchName.asBranchRevSpec()), + ) + } .pointed!! } /** Should be freed with [git_remote_free]. */ private fun MemScope.getOrigin(): git_remote? { return withAllocPointerTo { - val code = git_remote_lookup(it.ptr, repo, "origin") - if (code == ReturnCodes.ENOTFOUND) return null - checkError("git_remote_lookup", code) - } + val code = git_remote_lookup(it.ptr, repo, "origin") + if (code == ReturnCodes.ENOTFOUND) return null + checkError("git_remote_lookup", code) + } .pointed!! } @@ -557,20 +557,20 @@ class GitVersionControl(scope: MemScope, private val fs: FileSystem, private val private fun MemScope.getAnnotatedCommit(branchName: String): git_annotated_commit { return withAllocPointerTo { - checkError( - functionName = "git_annotated_commit_from_revspec", - result = git_annotated_commit_from_revspec(it.ptr, repo, branchName.asBranchRevSpec()), - ) - } + checkError( + functionName = "git_annotated_commit_from_revspec", + result = git_annotated_commit_from_revspec(it.ptr, repo, branchName.asBranchRevSpec()), + ) + } .pointed!! } private fun MemScope.getRebase(): git_rebase? { return withAllocPointerTo { - val code = git_rebase_open(it.ptr, repo, null) - if (code == ReturnCodes.ENOTFOUND) return null - checkError("git_rebase_open", code) - } + val code = git_rebase_open(it.ptr, repo, null) + if (code == ReturnCodes.ENOTFOUND) return null + checkError("git_rebase_open", code) + } .pointed } diff --git a/src/commonTest/kotlin/com/mattprecious/stacker/test/util/environment.kt b/src/commonTest/kotlin/com/mattprecious/stacker/test/util/environment.kt index e7da9aee..41d2e94a 100644 --- a/src/commonTest/kotlin/com/mattprecious/stacker/test/util/environment.kt +++ b/src/commonTest/kotlin/com/mattprecious/stacker/test/util/environment.kt @@ -118,17 +118,17 @@ class Environment { val stream = popen("$command 2>&1", "r") ?: fail("Command ($command) failed.") return buildString { - val buffer = ByteArray(4096) - while (true) { - val input = fgets(buffer.refTo(0), buffer.size, stream) ?: break - append(input.toKString()) - } - - val status = pclose(stream) - if (status != 0) { - fail("Command ($command) failed with status: $status.") - } + val buffer = ByteArray(4096) + while (true) { + val input = fgets(buffer.refTo(0), buffer.size, stream) ?: break + append(input.toKString()) } + + val status = pclose(stream) + if (status != 0) { + fail("Command ($command) failed with status: $status.") + } + } .trim() }