Skip to content

Commit

Permalink
SidePanel: Disallow copy context for not visible stashes (#10829)
Browse files Browse the repository at this point in the history
Incorrect info was copied.

Co-authored-by: Gerhard Olsson <gerhardol@users.noreply.github.com>
  • Loading branch information
gerhardol and gerhardol committed Mar 25, 2023
1 parent 6772ded commit e9884aa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 0 additions & 5 deletions GitUI/BranchTreePanel/BaseRevisionNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ protected BaseRevisionNode(Tree tree, string fullPath, bool visible)
/// </summary>
public string FullPath => ParentPath.Combine(PathSeparator.ToString(), Name)!;

/// <summary>
/// Gets whether the commit that the node represents is currently visible in the revision grid.
/// </summary>
public bool Visible { get; set; }

/// <summary>
/// ObjectId for nodes with a revision.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions GitUI/BranchTreePanel/NodeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ internal abstract class NodeBase
/// </summary>
protected internal bool IsSelected { get; set; }

/// <summary>
/// Gets whether the commit that the node represents is currently visible in the revision grid.
/// </summary>
public bool Visible { get; set; }

protected internal void Select(bool select, bool includingDescendants = false)
{
IsSelected = select;
Expand Down
2 changes: 1 addition & 1 deletion GitUI/BranchTreePanel/RepoObjectsTree.ContextActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IGitRefActions>().Any()); // enable if selection contains refs

var selectedLocalBranch = selectedNode as LocalBranchNode;
Expand Down

0 comments on commit e9884aa

Please sign in to comment.