diff --git a/GitUI/BranchTreePanel/BaseRevisionNode.cs b/GitUI/BranchTreePanel/BaseRevisionNode.cs index 14dd822314e..460438aeb95 100644 --- a/GitUI/BranchTreePanel/BaseRevisionNode.cs +++ b/GitUI/BranchTreePanel/BaseRevisionNode.cs @@ -37,11 +37,6 @@ protected BaseRevisionNode(Tree tree, string fullPath, bool visible) /// public string FullPath => ParentPath.Combine(PathSeparator.ToString(), Name)!; - /// - /// Gets whether the commit that the node represents is currently visible in the revision grid. - /// - public bool Visible { get; set; } - /// /// ObjectId for nodes with a revision. /// diff --git a/GitUI/BranchTreePanel/NodeBase.cs b/GitUI/BranchTreePanel/NodeBase.cs index b7904d46a7a..7a3d2c9132f 100644 --- a/GitUI/BranchTreePanel/NodeBase.cs +++ b/GitUI/BranchTreePanel/NodeBase.cs @@ -21,6 +21,11 @@ internal abstract class NodeBase /// protected internal bool IsSelected { get; set; } + /// + /// Gets whether the commit that the node represents is currently visible in the revision grid. + /// + public bool Visible { get; set; } + protected internal void Select(bool select, bool includingDescendants = false) { IsSelected = select; diff --git a/GitUI/BranchTreePanel/RepoObjectsTree.ContextActions.cs b/GitUI/BranchTreePanel/RepoObjectsTree.ContextActions.cs index 997f5740670..b3ede63bc25 100644 --- a/GitUI/BranchTreePanel/RepoObjectsTree.ContextActions.cs +++ b/GitUI/BranchTreePanel/RepoObjectsTree.ContextActions.cs @@ -212,7 +212,7 @@ private void contextMenu_Opening(object sender, CancelEventArgs e) bool hasSingleSelection = selectedNodes.Length == 1; NodeBase? selectedNode = treeMain.SelectedNode?.Tag as NodeBase; - copyContextMenuItem.Enable(hasSingleSelection && ((selectedNode is BaseBranchLeafNode branch && branch.Visible) || selectedNode is StashNode)); + copyContextMenuItem.Enable(hasSingleSelection && (selectedNode is BaseBranchLeafNode or StashNode) && selectedNode.Visible); filterForSelectedRefsMenuItem.Enable(selectedNodes.OfType().Any()); // enable if selection contains refs var selectedLocalBranch = selectedNode as LocalBranchNode;