x/tools/go/vcs: vcs.Cmd.TagSync will fail if the repository's default branch is not 'master' [Go 1.9] #22556
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
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 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.
The text was updated successfully, but these errors were encountered: