x/tools/go/vcs: vcs.Cmd.TagSync will fail if the repository's default branch is not 'master' [Go 1.9]
vipally opened this issue · 2 comments
-
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 -
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 -
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 masterBut current woring branch is not 'master' but 'develop'.
This command is proper usage:
git checkoutYou can see the test case here(TestDownloadAndSyncRepo):
https://github.com/vipally/tools/blob/master/go/vcs/vcs_test.go#L158and fix code here:
https://github.com/vipally/tools/blob/master/go/vcs/vcs.go#L115If confirm it as a bug, I will create a pullrequest to fix this issue.
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.