Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!!
}

Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down