Auto-commit after successful build: update app gameplay/UI, improve build setup

Changed files:\napp/build.gradle.kts
app/src/main/java/com/kawomi/githugandroid/GitRuntime.kt
This commit is contained in:
Joe Tretter
2026-04-23 06:37:04 -05:00
parent 3d3d49dd41
commit 600f1b275c
2 changed files with 11 additions and 6 deletions

View File

@@ -159,6 +159,14 @@ class GitRepositoryRuntime(private val context: Context) {
val logResult = runGit(nativeGit, sandbox, listOf("log", "--pretty=format:%h\t%s"))
val branchResult = runGit(nativeGit, sandbox, listOf("branch", "--list"))
val headResult = runGit(nativeGit, sandbox, listOf("branch", "--show-current"))
val commits = if (logResult.exitCode == 0) {
logResult.outputLines.filter { it.isNotBlank() }.mapNotNull { line ->
val parts = line.split('\t', limit = 2)
if (parts.isEmpty()) null else CommitNode(parts[0], parts.getOrElse(1) { "" })
}
} else {
emptyList()
}
return RepoState(
initialized = true,
@@ -171,10 +179,7 @@ class GitRepositoryRuntime(private val context: Context) {
tracked = tracked,
)
},
commits = logResult.outputLines.filter { it.isNotBlank() }.mapNotNull { line ->
val parts = line.split('\t', limit = 2)
if (parts.isEmpty()) null else CommitNode(parts[0], parts.getOrElse(1) { "" })
},
commits = commits,
headBranch = headResult.outputLines.firstOrNull()?.ifBlank { null } ?: "master",
branches = branchResult.outputLines.map { it.removePrefix("*").trim() }.filter { it.isNotBlank() }.associateWith { 0 },
)