- Notifications
You must be signed in to change notification settings - Fork914
Add missinng logic for delete a local branch#8650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Add missinng logic for delete a local branch#8650
Uh oh!
There was an error while loading.Please reload this page.
Conversation
mbien commentedJul 13, 2025
Chris2011 commentedJul 13, 2025
Thx, everything seems to work correctly beacuse if smth is wrong here, there witll be a GitException which shows the error: delete.checkout.branch.mp4So I'm fine with this behaviour. |
mbien commentedJul 13, 2025
right, saw that. This isn't great. Tools should not offer actions for operations which aren't supported by the impl. |
Chris2011 commentedJul 14, 2025
So you mean just disable the ok butten when the current checked out branch is selected? |
mbien commentedJul 14, 2025
something like that yeah, although removing the current branch from the list might be easier since it wouldn't involve having to update the branch selector UI which is probably used in many places. not tested: action: RepositoryInfoinfo =RepositoryInfo.getInstance(repository);HashMap<String,GitBranch>branches =newHashMap<>(info.getBranches());branches.remove(info.getActiveBranch().getName());if (branches.isEmpty()) {// TODO notify: "can't delete active branch"return; }BranchSelectorselector =newBranchSelector(repository,branches); new BranchSelector constructor: publicBranchSelector(Filerepository,HashMap<String,GitBranch>branches) {this.revisionPicker =newRevisionDialogController(repository,newFile[0],branches,null);panel =newSelectBranchPanel(revisionPicker.getPanel()); } would be nice to overwrite the enable() method of the action and turn it off if there is just one branch, but I am not 100% if it is a good idea to run the branch query on the EDT, I haven't looked into this deeper. |
mbien commentedJul 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
enable method: with that method you don't need the TODO |
Chris2011 commentedJul 21, 2025
@mbien added your requested code, I tested it with quick search -> delete branch, Menu -> team -> git -> branch ->delete branch and with the popup action on the project node. Seem working now. Thx. |
mbien left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
added a comment, there is now also a merge conflict to resolve.
please squash to one commit before integration - other than that looks good to me
Uh oh!
There was an error while loading.Please reload this page.
7addf3e to91d7d70Compare# Conflicts:#ide/git/src/org/netbeans/modules/git/ui/menu/BranchMenu.java
91d7d70 to22a3da8CompareChris2011 commentedJul 24, 2025
If there are no other concerns, I will probably merge this next week. |
1cd73c7 intoapache:masterUh oh!
There was an error while loading.Please reload this page.

Uh oh!
There was an error while loading.Please reload this page.
The logic was still implemented but action items are missing and the logic to select a branch to delete it. The problem was, when you do a quick search for delete, the delete was found and the UnsupportedOperationException was thrown. Now everything works as expected.
PR approval and merge checklist:
If this PR targets the delivery branch:don't merge. (full wiki article)