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:
@@ -11,6 +11,7 @@ class GitEditorCommandsTest {
|
||||
|
||||
assertEquals(GitEditorCommandKind.COMMIT_MESSAGE, invocation?.kind)
|
||||
assertEquals("Edit Commit Message", invocation?.title)
|
||||
assertEquals(".git/COMMIT_EDITMSG", invocation?.displayPath)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -34,6 +35,7 @@ class GitEditorCommandsTest {
|
||||
|
||||
assertEquals(GitEditorCommandKind.REBASE_TODO, invocation?.kind)
|
||||
assertEquals("Edit Rebase Todo", invocation?.title)
|
||||
assertEquals(".git/rebase-merge/git-rebase-todo", invocation?.displayPath)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -47,6 +49,7 @@ class GitEditorCommandsTest {
|
||||
|
||||
assertEquals(GitEditorCommandKind.TAG_MESSAGE, invocation?.kind)
|
||||
assertEquals("Edit Tag Message", invocation?.title)
|
||||
assertEquals(".git/TAG_EDITMSG", invocation?.displayPath)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user