Skip to content
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

x/tools/go/vcs: vcs.Cmd.TagSync will fail if the repository's default branch is not 'master' [Go 1.9] #22556

Open
vipally opened this Issue Nov 3, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@vipally
Copy link

vipally commented Nov 3, 2017

  1. I use this command to clone the default branch of repository:
    git clone --depth 1 https://github.com/vipally/binary test_downloads\github.com\vipally\binary

  2. And this repository's default branch is not 'master' but 'develop'
    git status
    On branch develop
    Your branch is up-to-date with 'origin/develop'.
    nothing to commit, working tree clean

  3. After that I wanna use this code to keep working directory up-to-date with remote
    vcs.Cmd.TagSync(path, "")

    But unfortunately it will fail with report:
    error: pathspec 'master' did not match any file(s) known to git.

    Because it use such command to sync remote:
    git checkout master

    But current woring branch is not 'master' but 'develop'.

    This command is proper usage:
    git checkout

    You can see the test case here(TestDownloadAndSyncRepo):
    https://github.com/vipally/tools/blob/master/go/vcs/vcs_test.go#L158

    and fix code here:
    https://github.com/vipally/tools/blob/master/go/vcs/vcs.go#L115

    If confirm it as a bug, I will create a pullrequest to fix this issue.

@gopherbot gopherbot added this to the Unreleased milestone Nov 3, 2017

@empijei

This comment has been minimized.

Copy link
Contributor

empijei commented Nov 6, 2017

I think this is cause by this https://github.com/golang/tools/blob/master/go/vcs/vcs.go#L292 that uses default command if present and a tag was not specified.

The default command https://github.com/golang/tools/blob/master/go/vcs/vcs.go#L116 uses master without invoking TagLookupCmd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.