mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-182203: git: Restore default branch hiding logic on root filtering
see: IJPL-177219 (cherry picked from commit a86facb5a83c44c5486d6434b83abb9d99713d76) IJ-MR-160938 GitOrigin-RevId: 7f2acb5099fa0cfc541fab142129664e4ff79720
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fa7c005ad9
commit
01bf1928d0
@@ -633,8 +633,6 @@
|
||||
description="GPG Agent configuration notification proposal (see git.commit.gpg.signing.enable.embedded.pinentry)"/>
|
||||
<registryKey key="git.read.branches.from.disk" defaultValue="false"
|
||||
description="When enabled, read the '.git/refs' directory contents. When disabled, delegate to 'git branch' call."/>
|
||||
<registryKey key="git.branch.dashboard.filter.branch.and.root" defaultValue="true"
|
||||
description="When repository grouping is enabled, both branches and root are filtered simultaneously"/>
|
||||
|
||||
<search.projectOptionsTopHitProvider implementation="git4idea.config.GitOptionsTopHitProvider"/>
|
||||
<vcs name="Git" vcsClass="git4idea.GitVcs" displayName="Git" administrativeAreaName=".git"/>
|
||||
@@ -830,6 +828,8 @@
|
||||
|
||||
<projectService serviceInterface="git4idea.commands.GitCommandOutputPrinter"
|
||||
serviceImplementation="git4idea.commands.GitCommandOutputConsolePrinter"/>
|
||||
<projectService serviceInterface="git4idea.ui.branch.dashboard.BranchesDashboardFilteringLogic"
|
||||
serviceImplementation="git4idea.ui.branch.dashboard.DefaultBranchDashboardFilteringLogic"/>
|
||||
<vcs.consoleFolding implementation="git4idea.console.GitConsoleFoldingImpl"/>
|
||||
<console.folding implementation="git4idea.console.GitProgressOutputConsoleFolding"/>
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package git4idea.ui.branch.dashboard
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
* Expected to be overridden only in the workspace model plugin.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
interface BranchesDashboardFilteringLogic {
|
||||
/**
|
||||
* `true` means that branches in the branch dashboard tree will be hidden for roots excluded in the root filter
|
||||
*/
|
||||
fun showBranchesMatchingRootFilter(): Boolean
|
||||
|
||||
/**
|
||||
* Defines filtering logic in case of grouping by repository is enabled.
|
||||
*
|
||||
* `true` means that log will be filtered by both branch name and root, `false` - only by branch name.
|
||||
*/
|
||||
fun filterByBranchAndRoot(): Boolean
|
||||
}
|
||||
|
||||
internal class DefaultBranchDashboardFilteringLogic : BranchesDashboardFilteringLogic {
|
||||
override fun showBranchesMatchingRootFilter(): Boolean = true
|
||||
override fun filterByBranchAndRoot(): Boolean = !showBranchesMatchingRootFilter()
|
||||
}
|
||||
+4
-10
@@ -3,11 +3,11 @@ package git4idea.ui.branch.dashboard
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.openapi.actionSystem.*
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Comparing
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.NlsActions
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager
|
||||
import com.intellij.openapi.vcs.VcsRoot
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
@@ -106,7 +106,7 @@ internal class BranchesVcsLogUi(
|
||||
val roots = logData.roots.toSet()
|
||||
val logUiFilterListener = VcsLogFilterUiEx.VcsLogFilterListener {
|
||||
model.rootsToFilter = when {
|
||||
roots.size == 1 || BranchesDashboardBehaviour.alwaysShowBranchForAllRoots() -> roots
|
||||
roots.size == 1 || !logData.project.service<BranchesDashboardFilteringLogic>().showBranchesMatchingRootFilter() -> roots
|
||||
else -> VcsLogUtil.getAllVisibleRoots(roots, filterUi.filters)
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ internal class BranchesVcsLogUi(
|
||||
}
|
||||
|
||||
override fun filterBy(branches: List<String>, repositories: Set<GitRepository>) {
|
||||
if (BranchesDashboardBehaviour.filterByBranchAndRoot() && repositories.isNotEmpty()) {
|
||||
if (logData.project.service<BranchesDashboardFilteringLogic>().filterByBranchAndRoot() && repositories.isNotEmpty()) {
|
||||
val roots = repositories.map { it.root }.takeIf { !Comparing.haveEqualElements(logData.roots, it) }
|
||||
filterUi.filterBy(branches, roots)
|
||||
}
|
||||
@@ -292,10 +292,4 @@ val CHANGE_LOG_FILTER_ON_BRANCH_SELECTION_PROPERTY: VcsLogUiProperties.VcsLogUiP
|
||||
val NAVIGATE_LOG_TO_BRANCH_ON_BRANCH_SELECTION_PROPERTY: VcsLogUiProperties.VcsLogUiProperty<Boolean> =
|
||||
object : VcsLogApplicationSettings.CustomBooleanProperty("Navigate.Log.To.Branch.on.Branch.Selection") {
|
||||
override fun defaultValue() = false
|
||||
}
|
||||
|
||||
private object BranchesDashboardBehaviour {
|
||||
fun alwaysShowBranchForAllRoots(): Boolean = filterByBranchAndRoot()
|
||||
|
||||
fun filterByBranchAndRoot(): Boolean = Registry.`is`("git.branch.dashboard.filter.branch.and.root")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user