You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
If a tag is created pointing to a commit that hasn't been pushed yet, then the checkout will error. However, git works, and the commit is browse-able on GitHub. However, you can see its not in the commit history at all.
The only reason this feels like a bug to me is really because git show <tag> and git checkout <tag> somehow work despite the commit not being easily viewable in any other way.
Notice the tag v0.1.0 points to a commit (you can click it and see it), but if you go to the commit history it doesn't exist, and there are no other branches either. This is a lightweight tag. But clone the repository manually and you'll be able to use that tag with git.
And some code you can run with go run to reproduce this:
package main
import (
"fmt""io/ioutil""os""gopkg.in/src-d/go-git.v4""gopkg.in/src-d/go-git.v4/plumbing"
)
funcmain() {
// Create the temporary directory for cloningdir, err:=ioutil.TempDir("", "test")
iferr!=nil {
panic(err)
}
// Clone it into the target directory getting only the tag commitrepo, err:=git.PlainClone(dir, false, &git.CloneOptions{
URL: "https://github.com/mitchellh/go-git-test-failure.git",
})
iferr!=nil {
os.RemoveAll(dir)
panic(err)
}
// Get the working tree so we can change refstree, err:=repo.Worktree()
iferr!=nil {
panic(err)
}
tagName:="v0.1.0"// Checkout our tagerr=tree.Checkout(&git.CheckoutOptions{
Branch: plumbing.ReferenceName("refs/tags/"+tagName),
})
iferr!=nil {
panic(err)
}
fmt.Println(dir)
}
The text was updated successfully, but these errors were encountered:
If a tag is created pointing to a commit that hasn't been pushed yet, then the checkout will error. However,
git
works, and the commit is browse-able on GitHub. However, you can see its not in the commit history at all.The only reason this feels like a bug to me is really because
git show <tag>
andgit checkout <tag>
somehow work despite the commit not being easily viewable in any other way.I created a test repository to reproduce this: https://github.com/mitchellh/go-git-test-failure
Notice the tag
v0.1.0
points to a commit (you can click it and see it), but if you go to the commit history it doesn't exist, and there are no other branches either. This is a lightweight tag. But clone the repository manually and you'll be able to use that tag withgit
.And some code you can run with
go run
to reproduce this:The text was updated successfully, but these errors were encountered: