Open patch hunk editor for git add -p edit command
This commit is contained in:
@@ -405,10 +405,15 @@ fun GitHugApp() {
|
||||
|
||||
fun openGitMessageEditor(invocation: GitEditorInvocation) {
|
||||
val initialContent = runtime.gitEditorInitialContent(currentLevel, repo, invocation)
|
||||
val openedMessage = when (invocation.kind) {
|
||||
GitEditorCommandKind.REBASE_TODO -> "Opened Git rebase editor"
|
||||
GitEditorCommandKind.PATCH_HUNK -> "Opened Git patch editor"
|
||||
else -> "Opened Git message editor"
|
||||
}
|
||||
output = buildList {
|
||||
addAll(output)
|
||||
add("$ ${invocation.command}")
|
||||
add(if (invocation.kind == GitEditorCommandKind.REBASE_TODO) "Opened Git rebase editor" else "Opened Git message editor")
|
||||
add(openedMessage)
|
||||
}
|
||||
gitMessageEditorState = GitMessageEditorState(
|
||||
invocation = invocation.copy(initialContent = initialContent),
|
||||
@@ -474,6 +479,12 @@ fun GitHugApp() {
|
||||
return
|
||||
}
|
||||
|
||||
val patchHunkEditorInvocation = GitSandboxEngine.parsePatchHunkEditorInvocation(repo, raw)
|
||||
if (patchHunkEditorInvocation != null) {
|
||||
openGitMessageEditor(patchHunkEditorInvocation)
|
||||
return
|
||||
}
|
||||
|
||||
val (newRepo, lines) = runtime.execute(currentLevel, repo, raw)
|
||||
applyCommandResult(raw, newRepo, lines, echoCommand = !isInteractiveInput)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user