This repository was archived by the owner on Sep 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 534
Clone can't checkout commit pointed to by tag, but Git works #574
Labels
Comments
The problem is the following: By default when you clone a repository, only the tags that belong to any of the branches being clone are created in the local repository. Since this tag points to a commit that is not in the history of the branch master, the tags doesn't exists locally. I though that this was the behavior of git, but apparently isn't. I will try find this code in git and then I will fix the issue. |
Ok I found the logic on git. Making a PR. |
Thanks! I'll look for the v4 gopkg update and grab it. :) |
Thanks, confirmed it works great. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Uh oh!
There was an error while loading. Please reload this page.
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: