Skip to content

Compare branch selector is disabled when there are 2 branches or fewer in a repo #4947

Closed

Description

@iAmWillShepherd

Description

While testing #4874 using a test repo, I noticed the compare branch selector was disabled. Given that I had 2 branches, I expected that I'd be able to compare. Turns out we do a bit of filtering here:

const allBranches =
currentBranch != null
? branchesState.allBranches.filter(b => b.name !== currentBranch.name)
: branchesState.allBranches
const recentBranches = currentBranch
? branchesState.recentBranches.filter(b => b.name !== currentBranch.name)
: branchesState.recentBranches
const cachedDefaultBranch = branchesState.defaultBranch

What weren't doing was taking that filtering into account when we enabled or disabled the compare branch selector. Basically we are off by 1.

Version

  • GitHub Desktop: Dev build
  • Operating system: macOS

Steps to Reproduce

  1. Create a new repo on GitHub.com and clone it
  2. Create a new branch and publish it
  3. Verify you cannot compare a branch

Expected Behavior

I should be able to select a branch to compare against

Actual Behavior

Compare branch selector is disabled

Additional Information

2018-06-15 10 30 16

Logs

Logs won't be helpful here, but here is an image of the state we use to enable the selector.
screen shot 2018-06-15 at 10 11 19 am

Activity

  1. locked as resolved and limited conversation to collaborators on Aug 15, 2018
  2. unlocked this conversation on Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions