shurcooL / Go-Package-Store

An app that displays updates for the Go packages in your GOPATH.
MIT License
900 stars 29 forks source link

workspace: Check local branch matches default branch first. #75

Closed dmitshur closed 7 years ago

dmitshur commented 7 years ago

We want to check if local branch doesn't match default (as determined from remote) branch before we check if local revision is empty. This way, we can report a better error message in a case where the default branch doesn't exist locally.

Add a sanity check to ensure Remote.Branch is not empty. It's not expected to be. For consistency with Remote.Revision being empty check.

Fixes #74.

Before

$ Go-Package-Store 
Using all Go packages in GOPATH.
Go Package Store server is running at http://localhost:7043/updates.
skipping "gopkg.in/src-d/go-git.v4" because:
    local revision is empty

After

$ Go-Package-Store 
Using all Go packages in GOPATH.
Go Package Store server is running at http://localhost:7043/updates.
skipping "gopkg.in/src-d/go-git.v4" because:
    local branch "v4" doesn't match remote branch "master"

/cc @mvdan FYI.

mvdan commented 7 years ago

Awesome, thanks!