Skip to content

Git push dialog: Sort active git branch to top and select it automatically#9385

Open
OndroMih wants to merge 1 commit into
apache:masterfrom
OndroMih:git-push-dialog-branch-selection
Open

Git push dialog: Sort active git branch to top and select it automatically#9385
OndroMih wants to merge 1 commit into
apache:masterfrom
OndroMih:git-push-dialog-branch-selection

Conversation

@OndroMih
Copy link
Copy Markdown
Contributor

@OndroMih OndroMih commented May 9, 2026

Select it automatically unless it contains destructive actions.
Sort active tag to top, do not select it automatically.
Display "(active)" next to the branch/tag name.

image

^Add meaningful description above

Click to collapse/expand PR instructions

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

PR approval and merge checklist:

  1. Was this PR correctly labeled, did the right tests run? When did they run?
  2. Is this PR squashed?
  3. Are author name / email address correct? Are co-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)

Select it automatically unless it contains destructive actions.
Sort active tag to top, do not select it automatically.
Display "(active)" next to the branch/tag name.
@matthiasblaesing matthiasblaesing added this to the NB31 milestone May 14, 2026
@matthiasblaesing matthiasblaesing added the git [ci] enable versioning job label May 14, 2026
@apache apache locked and limited conversation to collaborators May 14, 2026
@apache apache unlocked this conversation May 14, 2026
@matthiasblaesing matthiasblaesing changed the title Sort active git branch to top and select it automatically Git push dialog: Sort active git branch to top and select it automatically May 14, 2026
Copy link
Copy Markdown
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea makes sense to me. I.e. having the active branch on top as that is the most likely branch to be relevant for the user. Also selecting it if the target does not yet exist makes sense IMHO.

However I left two inline comments for your consideration.

this.active = active;
String displayName = localName;
if (active && localName != null) {
displayName = localName + " (active)"; //NOI18N
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the NOI18N tag is invalid here. If anyone wants to localize this is a good candidate.

}
}
boolean preselected = !conflicted && updateNeeded;
boolean preselected = !conflicted && (updateNeeded || branch.isActive());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the branch.isActive() check should only be considered if remoteBranch is null. If remoteBranch is non-null, the logic already does the right thing, only new branches need to be considered.

Currently this can happen:

Image

The checked state for the active branch makes no sense, as there is nothing to push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

git [ci] enable versioning job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants