From abbf408aedc8161df44d68a88d48ff60dcdea43d Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 20 Jun 2019 11:41:36 +0100 Subject: [PATCH] git: don't save and don't load branch filters in the Update Info tab These could be accidentally set by a user, e.g. to "HEAD", since it is easy to confuse the Update Info tab with an ordinary Log tab. And then the next Update Project will show "100500 commits matching filter", where 100500 is the number of all commits reachable from the HEAD. IDEA-216661 GitOrigin-RevId: c6f6d57337ceda1b397254db5adda5286939cae5 --- .../src/git4idea/update/GitUpdateInfoAsLog.kt | 11 +++++------ .../update/GitUpdateProjectInfoLogProperties.java | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateInfoAsLog.kt b/plugins/git4idea/src/git4idea/update/GitUpdateInfoAsLog.kt index 224b94c04aa9..c84ce3320867 100644 --- a/plugins/git4idea/src/git4idea/update/GitUpdateInfoAsLog.kt +++ b/plugins/git4idea/src/git4idea/update/GitUpdateInfoAsLog.kt @@ -15,7 +15,7 @@ import com.intellij.ui.GuiUtils import com.intellij.util.ContentUtilEx import com.intellij.util.text.DateFormatUtil import com.intellij.vcs.log.CommitId -import com.intellij.vcs.log.VcsLogFilterCollection.RANGE_FILTER +import com.intellij.vcs.log.VcsLogFilterCollection.* import com.intellij.vcs.log.VcsLogRangeFilter import com.intellij.vcs.log.data.DataPack import com.intellij.vcs.log.data.DataPackChangeListener @@ -129,11 +129,10 @@ class GitUpdateInfoAsLog(private val project: Project, private class MyPropertiesForRange(val rangeFilter: VcsLogRangeFilter, val mainProperties: GitUpdateProjectInfoLogProperties) : MainVcsLogUiProperties by mainProperties { override fun getFilterValues(filterName: String): List? { - if (filterName === RANGE_FILTER.name) { - return ArrayList(rangeFilter.getTextPresentation()) - } - else { - return mainProperties.getFilterValues(filterName) + when { + filterName === RANGE_FILTER.name -> return ArrayList(rangeFilter.getTextPresentation()) + filterName == BRANCH_FILTER.name || filterName == REVISION_FILTER.name -> return null + else -> return mainProperties.getFilterValues(filterName) } } diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProjectInfoLogProperties.java b/plugins/git4idea/src/git4idea/update/GitUpdateProjectInfoLogProperties.java index 2c92a9a67f86..f4a79ba0a7c3 100644 --- a/plugins/git4idea/src/git4idea/update/GitUpdateProjectInfoLogProperties.java +++ b/plugins/git4idea/src/git4idea/update/GitUpdateProjectInfoLogProperties.java @@ -16,7 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.intellij.vcs.log.VcsLogFilterCollection.RANGE_FILTER; +import static com.intellij.vcs.log.VcsLogFilterCollection.*; @State( name = "Git.Update.Project.Info.Tabs.Properties", @@ -57,7 +57,7 @@ public class GitUpdateProjectInfoLogProperties extends VcsLogUiPropertiesImpl values) { - if (filterName != RANGE_FILTER.getName()) { + if (filterName != RANGE_FILTER.getName() && filterName != BRANCH_FILTER.getName() && filterName != REVISION_FILTER.getName()) { super.saveFilterValues(filterName, values); } }