Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 87c7109

Browse files
authored
Merge branch 'master' into fixes/settings-view-git-remote-update
2 parents 8c961a1 + a6c5049 commit 87c7109

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,23 @@ private void OnCreateGUI()
456456
// Create button
457457
if (mode == BranchesMode.Default)
458458
{
459+
// If the current branch is selected, then do not enable the Delete button
460+
var disableDelete = activeBranchNode == selectedNode;
461+
EditorGUI.BeginDisabledGroup(disableDelete);
462+
{
463+
if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
464+
{
465+
var selectedBranchName = selectedNode.Name;
466+
var dialogTitle = "Delete Branch: " + selectedBranchName;
467+
var dialogMessage = "Are you sure you want to delete the branch: " + selectedBranchName + "?";
468+
if (EditorUtility.DisplayDialog("Delete Branch?", dialogMessage, "Delete", "Cancel"))
469+
{
470+
GitClient.DeleteBranch(selectedBranchName, true).Start();
471+
}
472+
}
473+
}
474+
EditorGUI.EndDisabledGroup();
475+
459476
GUILayout.FlexibleSpace();
460477
if (GUILayout.Button(CreateBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
461478
{

0 commit comments

Comments
 (0)