Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

@Chris2011
Copy link
Contributor

@Chris2011Chris2011 commentedJul 12, 2025
edited by mbien
Loading

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:

  1. Was this PRcorrectly labeled, did the right tests run? When did they run?
  2. Is this PRsquashed?
  3. Are author name / email address correct? Areco-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch:don't merge. (full wiki article)

@Chris2011Chris2011 self-assigned thisJul 12, 2025
@Chris2011Chris2011 added enhancement git[ci] enable versioning job ci:dev-build[ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labelsJul 12, 2025
@mbien
Copy link
Member

this would have to make sure that the currently checked out branch isn't offered for deletion, since this can't be done.

the repo browser does have the delete action too and does it correctly:
image

@Chris2011
Copy link
ContributorAuthor

Thx, everything seems to work correctly beacuse if smth is wrong here, there witll be a GitException which shows the error:

delete.checkout.branch.mp4

So I'm fine with this behaviour.

@mbien
Copy link
Member

right, saw that. This isn't great. Tools should not offer actions for operations which aren't supported by the impl.

@Chris2011
Copy link
ContributorAuthor

So you mean just disable the ok butten when the current checked out branch is selected?

@mbien
Copy link
Member

So you mean just disable the ok butten when the current checked out branch is selected?

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
Copy link
Member

mbien commentedJul 14, 2025
edited
Loading

enable method:

    @Override    protected boolean enable(Node[] activatedNodes) {        Map.Entry<File, File[]> actionRoots = getActionRoots(getCurrentContext(activatedNodes));        if (actionRoots != null) {            RepositoryInfo info = RepositoryInfo.getInstance(actionRoots.getKey());            return info.getBranches().size() > 1 && super.enable(activatedNodes);        }        return false;    }

with that method you don't need the TODO

@Chris2011
Copy link
ContributorAuthor

@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.

Copy link
Member

@mbienmbien left a 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

@Chris2011Chris2011force-pushed thefeature/add-delete-branch-logic branch from7addf3e to91d7d70CompareJuly 23, 2025 11:22
# Conflicts:#ide/git/src/org/netbeans/modules/git/ui/menu/BranchMenu.java
@Chris2011Chris2011force-pushed thefeature/add-delete-branch-logic branch from91d7d70 to22a3da8CompareJuly 23, 2025 11:46
@Chris2011Chris2011 requested a review frommbienJuly 23, 2025 11:51
@Chris2011Chris2011 added this to theNB28 milestoneJul 23, 2025
@Chris2011
Copy link
ContributorAuthor

If there are no other concerns, I will probably merge this next week.

@Chris2011Chris2011 merged commit1cd73c7 intoapache:masterJul 29, 2025
31 checks passed
@Chris2011Chris2011 deleted the feature/add-delete-branch-logic branchJuly 29, 2025 11:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mbienmbienmbien approved these changes

@matthiasblaesingmatthiasblaesingAwaiting requested review from matthiasblaesing

Assignees

@Chris2011Chris2011

Labels

ci:dev-build[ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page)enhancementgit[ci] enable versioning job

Projects

None yet

Milestone

NB28

Development

Successfully merging this pull request may close these issues.

2 participants

@Chris2011@mbien

[8]ページ先頭

©2009-2025 Movatter.jp