-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(push): fix tracking reference not well selected #11954
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Looks sensible, have not run either
@@ -780,24 +780,27 @@ private void BranchSelectedValueChanged(object sender, EventArgs e) | |||
{ | |||
if (PushToRemote.Checked) | |||
{ | |||
if (_NO_TRANSLATE_Branch.SelectedItem is GitRef branch) | |||
IGitRef selectedRef = _NO_TRANSLATE_Branch.SelectedItem as IGitRef; |
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.
Why change the name?
IGitRef selectedRef = _NO_TRANSLATE_Branch.SelectedItem as IGitRef; | |
IGitRef branch = _NO_TRANSLATE_Branch.SelectedItem as IGitRef; |
or
IGitRef selectedRef = _NO_TRANSLATE_Branch.SelectedItem as IGitRef; | |
IGitRef branchRef = _NO_TRANSLATE_Branch.SelectedItem as IGitRef; |
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.
branch
is not expressive at all for me.
Because we take the SelectedItem
it seems natural to me to have selected
in the name.
I would prefer selectedBranchRef
or, as a 2nd choice, branchRef
.
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.
I, too, am fine with selectedBranchRef
.
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.
I'm not sure this is a more correct fix than proposed by me in #11950.
The reason is that the order of the dropdown initialisation is still incorrect, which means _NO_TRANSLATE_Branch.SelectedItem
is null when the dialog first loaded and this method executes.
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.
I believe this PR addresses the core problem I see: The selected ref is not always correct. I have seen that occasionally but not have been able to reproduce. The remote ref may not always match the local.
It can well be merged together with #11950 that also addresses the standard case
It was made on purpose to not load the items of the combobox (and load them only when interacting with it) so that there is no slow down on opening (especially when you have a lot of local branches). As a consequence, indeed,
You could reproduce it when trying to push to a tracking remote branch that has not the same name than the local branch.
@RussKie If you prefer your fix, you will have to handle the case where you are in detached HEAD state. |
Oh, that's the insights I wasn't aware of. This makes sense, and it'd be great to add comments capturing this knowledge, so no one would try to "fix" it again. |
Done. |
@@ -780,24 +780,27 @@ private void BranchSelectedValueChanged(object sender, EventArgs e) | |||
{ | |||
if (PushToRemote.Checked) | |||
{ | |||
if (_NO_TRANSLATE_Branch.SelectedItem is GitRef branch) | |||
IGitRef selectedRef = _NO_TRANSLATE_Branch.SelectedItem as IGitRef; |
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.
I, too, am fine with selectedBranchRef
.
by retrieving the gitref corresponding to local branch combobox text fixes gitextensions#11899
4516d69
to
279fd4c
Compare
Renamed. Squashed and rebased.... |
by retrieving the gitref corresponding to local branch combobox
fixes #11899
Screenshots
Before
After
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.