Auto-commit after successful build (2026-04-21 21:28:05)

This commit is contained in:
Joe Tretter
2026-04-21 21:28:05 -05:00
parent 8303cfdea6
commit 45e2452015
2 changed files with 149 additions and 11 deletions

View File

@@ -113,8 +113,12 @@ object GitSandboxEngine {
parts.size >= 2 && parts[1] == "status" -> repo to statusLines(repo)
parts.size >= 3 && parts[1] == "add" -> {
val target = parts[2]
val updated = repo.files.map { if (target == "." || it.name == target) it.copy(staged = true) else it }
repo.copy(files = updated) to listOf("staged ${if (target == ".") "all files" else target}")
if (target != "." && repo.files.none { it.name == target }) {
repo to listOf("fatal: pathspec '$target' did not match any files")
} else {
val updated = repo.files.map { if (target == "." || it.name == target) it.copy(staged = true) else it }
repo.copy(files = updated) to listOf("staged ${if (target == ".") "all files" else target}")
}
}
parts.size >= 2 && parts[1] == "commit" -> commit(repo, parts)
parts.size >= 2 && parts[1] == "log" -> {