Fix Git editor reword workflow and UI coverage

- show Git editor file paths instead of the submitted git command
- surface follow-up commit message editors during interactive rebase reword
- add rename-commit UI tests for editor and amend-message solution paths
- add broader embedded level solution scenarios for alternate Git workflows
This commit is contained in:
Joe Tretter
2026-06-26 11:23:16 -05:00
parent 2db8fdd328
commit 781b5090f7
49 changed files with 372 additions and 19 deletions

View File

@@ -2,6 +2,8 @@ package solutions.tretter.githugandroid
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Assume.assumeTrue
import org.junit.Test
@@ -451,6 +453,39 @@ class GitSandboxEngineTest {
}
}
@Test
fun nativeInteractiveRebaseRewordRequestsCommitMessageEditorAndContinues() {
val git = testGitBinary()
assumeTrue(git.exists() && git.canExecute())
val root = Files.createTempDirectory("githug-interactive-rebase-reword-editor").toFile()
try {
val runtime = GitRepositoryRuntime(root, git)
val level = renameCommitLevel()
val repo = runtime.prepareLevel(level)
val invocation = parseGitEditorInvocation("git rebase -i HEAD~2")
?: error("Expected interactive rebase editor invocation")
val todo = runtime.gitEditorInitialContent(level, repo, invocation)
val rewordTodo = todo.replaceFirst(Regex("(?m)^pick "), "reword ")
val rebaseResult = runtime.executeGitEditorCommandWithResult(level, repo, invocation, rewordTodo)
val nextEditor = rebaseResult.nextEditor
assertNotNull(nextEditor)
val message = nextEditor!!.content.replaceFirst("First coommit", "First commit")
val completedResult = runtime.executeGitEditorCommandWithResult(
level = level,
currentRepo = rebaseResult.repo,
invocation = nextEditor.invocation,
message = message,
)
assertEquals(".git/COMMIT_EDITMSG", nextEditor.invocation.displayPath)
assertNull(completedResult.nextEditor)
assertTrue(level.validator(completedResult.repo, nextEditor.invocation.command))
} finally {
root.deleteRecursively()
}
}
@Test
fun nativeExecutableShortcutRunsScriptThroughShell() {
val git = testGitBinary()