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:
@@ -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 },
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user