From 2ca2dc8b8b24fb45cb059855569d661318d4a1bd Mon Sep 17 00:00:00 2001 From: Daniil Tsaryov Date: Mon, 8 Jun 2020 19:00:20 +0300 Subject: [PATCH] Pre-select only tracked branch or matched by name in git pull dialog IDEA-242775 GitOrigin-RevId: 5e852722810c13f10f10b82eb48c94e8bc68eec5 --- plugins/git4idea/src/git4idea/pull/GitPullDialog.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/pull/GitPullDialog.kt b/plugins/git4idea/src/git4idea/pull/GitPullDialog.kt index 1900464227e6..e4e87c827b2a 100644 --- a/plugins/git4idea/src/git4idea/pull/GitPullDialog.kt +++ b/plugins/git4idea/src/git4idea/pull/GitPullDialog.kt @@ -124,7 +124,12 @@ class GitPullDialog(private val project: Project, val model = branchField.model as MutableCollectionComboBoxModel model.update(branches) - model.selectedItem = branches.getOrElse(0) { "" } + + val matchingBranch = repository.currentBranch?.findTrackedBranch(repository)?.nameForRemoteOperations + ?: branches.find { branch -> branch == repository.currentBranchName } + ?: "" + + model.selectedItem = matchingBranch } private fun getRemoteBranches(repository: GitRepository, remote: GitRemote): List {