question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select Branch to Compare Selects Wrong Branch

See original GitHub issue

Describe the bug

When I click on the Select Branch to Compare dropdown and pick a branch that I want to compare to my current branch, the wrong branch is picked and placed into that field. This only happens in specific repositories, not all. The only way to pick the branch I want is to type it in until the list filters down to the one I want, then select it.

Version & OS

macOS 10.15.5 GitHub Desktop 2.5.2

Steps to reproduce the behavior

Unfortunately, this doesn’t work in every repo and I can’t determine what is exactly causing it in order to make a reproducible example. Currently, this is happening with my work repositories, so I cannot even provide a link to a repo that exhibits the bug or provide a screen capture video.

  1. Click “Select Branch to Compare”
  2. Pick a branch
  3. Notice that the branch that shows up as the selected branch is not the one you chose
  4. See error

Expected behavior

I would expect the correct branch to be selected

Actual behavior

The wrong branch is selected

Screenshots

Unable to post any unless I can reproduce it in a non-private repository.

Logs

Attach your logs by opening the Help menu and selecting Show Logs..., if applicable.

Additional context

It seems to happen with branches that are similarly prefixed. What I’m noticing is happening with my work repositories is that if there are two branches named:

  1. X
  2. XY

Where X and Y can be full words or multiple words

If I select the X branch, the XY branch is selected. I don’t think I’ve noticed a case where I pick branch X and some other branch that doesn’t have X as a prefix is selected. The weird thing is, I’ve tried recreating this in a new repository, but I am not able to reproduce the bug there. I will update this issue if I can find a way to reproduce it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rafecacommented, Jun 10, 2020

Thanks for the information @tierninho and @JosephTLyons ! This is a great catch!

I’ve been able to reproduce the issue now! it looks like a race condition between the mouse handlers, going to see if it’s easy to send a quick fix for this.

2reactions
JosephTLyonscommented, Jun 9, 2020

I was able to successfully recreate this. Every time I click compare X it reverts to XY branch, but not vice-versa.

I used a private repo (https://github.com/tierninho/STASHd), with two branches (in addition to master). I renamed both branches as X and XY. When I try to compare master against X, it always reverts to XY. I noticed you have to be on master to see the bug.

I think the renaming both branches affected this. I had two branches with similar names and everything worked fine. As soon as I renamed them both to X and XY , bingo.

Hmmm, I’m not sure I had to rename my branches to get it to happen. I think it happened just after creating them. I will say that after encountering this bug for many weeks, I have noticed that it actually doesn’t happen every time. I can get it to happen many times in a row, then randomly it won’t happen. Maybe you were lucky enough to have to work properly in the case where you didn’t rename the branches and have it now work in the case where you did rename the branches.

Read more comments on GitHub >

github_iconTop Results From Across the Web

About comparing branches in pull requests
Pull requests display diffs to compare the changes you made in your topic branch against the base branch that you want to merge...
Read more >
Git diff between current branch and master but not ...
This shows only the changes between my currently selected local branch and the remote master branch, and ignores all changes in my local ......
Read more >
Allow to compare any two branches : IDEA-125616 - YouTrack
Currently IDEA allows to compare current branch with another one. Please, allow to compare two branches or commits selected in GIT "Changes |...
Read more >
Git - Compare Branches - Visual Studio Feedback
From the Branches view on the Team Explorer. Select two branches. Right clicking one of them would reveal an option to compare them....
Read more >
Unfuddle Support | Git - Compare Two Branches
Using git-diff you can compare two branches by viewing a diff between them, or you can use git-log to view a list of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found