diff --git a/plugins/git4idea/resources/META-INF/plugin.xml b/plugins/git4idea/resources/META-INF/plugin.xml
index e61e01a1a3ad..3f0ca732f67b 100644
--- a/plugins/git4idea/resources/META-INF/plugin.xml
+++ b/plugins/git4idea/resources/META-INF/plugin.xml
@@ -262,6 +262,7 @@
+
@@ -275,6 +276,7 @@
+
diff --git a/plugins/git4idea/resources/messages/GitBundle.properties b/plugins/git4idea/resources/messages/GitBundle.properties
index e43636936f8e..9988515c503c 100644
--- a/plugins/git4idea/resources/messages/GitBundle.properties
+++ b/plugins/git4idea/resources/messages/GitBundle.properties
@@ -614,6 +614,7 @@ action.NotificationAction.GithubNotifications.text.configure=Configure...
action.NotificationAction.GitMergeAction.text.view.commits=View Commits
action.NotificationAction.GitRewordOperation.text.undo=Undo
action.NotificationAction.GitUpdateSession.text.view.commits=View Commits
+action.Git.Stage.ThreeSideDiff.text=Add Interactively...
settings.git.option.group=Git
settings.commit.automatically.on.cherry.pick=Commit automatically on cherry-pick
diff --git a/plugins/git4idea/src/git4idea/index/actions/GitStageDiffAction.kt b/plugins/git4idea/src/git4idea/index/actions/GitStageDiffAction.kt
index c2494adf483d..5024c14b16cb 100644
--- a/plugins/git4idea/src/git4idea/index/actions/GitStageDiffAction.kt
+++ b/plugins/git4idea/src/git4idea/index/actions/GitStageDiffAction.kt
@@ -5,9 +5,11 @@ import com.intellij.diff.DiffDialogHints
import com.intellij.diff.DiffManager
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.AnActionExtensionProvider
+import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain
import com.intellij.util.containers.isEmpty
import git4idea.index.createThreeSidesDiffRequestProducer
+import git4idea.index.createTwoSidesDiffRequestProducer
import git4idea.index.ui.GIT_FILE_STATUS_NODES_STREAM
import git4idea.index.ui.GIT_STAGE_TRACKER
import kotlin.streams.toList
@@ -20,6 +22,18 @@ class GitStageDiffAction : AnActionExtensionProvider {
e.presentation.isVisible = e.presentation.isEnabled || e.isFromActionToolbar
}
+ override fun actionPerformed(e: AnActionEvent) {
+ val producers = e.getRequiredData(GIT_FILE_STATUS_NODES_STREAM).map { createTwoSidesDiffRequestProducer(e.project!!, it) }.toList()
+ DiffManager.getInstance().showDiff(e.project, ChangeDiffRequestChain(producers, 0), DiffDialogHints.DEFAULT)
+ }
+}
+
+class GitStageThreeSideDiffAction : DumbAwareAction() {
+ override fun update(e: AnActionEvent) {
+ e.presentation.isEnabled = e.project != null && !e.getData(GIT_FILE_STATUS_NODES_STREAM).isEmpty()
+ e.presentation.isVisible = e.presentation.isEnabled || e.isFromActionToolbar
+ }
+
override fun actionPerformed(e: AnActionEvent) {
val producers = e.getRequiredData(GIT_FILE_STATUS_NODES_STREAM).map { createThreeSidesDiffRequestProducer(e.project!!, it) }.toList()
DiffManager.getInstance().showDiff(e.project, ChangeDiffRequestChain(producers, 0), DiffDialogHints.DEFAULT)