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
Reference IsTag() is broken #461
Comments
Here is the workaround I am using:
|
The HEAD when a tag is checkout is not a symbolic reference, is a reference pointing to a commit, this is called detached HEAD. So your solution is the right approach to know witch tag was checkout. > git clone [email protected]:src-d/go-git.git -b v4.0.0-rc11
Cloning into 'go-git'...
remote: Counting objects: 6745, done.
remote: Total 6745 (delta 0), reused 0 (delta 0), pack-reused 6745
Receiving objects: 100% (6745/6745), 14.85 MiB | 191.00 KiB/s, done.
Resolving deltas: 100% (4028/4028), done.
Note: checking out 'ad02bf020460c210660db4fffda7f926b6aae95a'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
> git show-ref --head HEAD mcuadros@mcuadros-xps-arch
ad02bf020460c210660db4fffda7f926b6aae95a HEAD
102d4b5aeb9b3cbd544c59706a1b0dd9300ddcc8 refs/remotes/origin/HEAD
> git status -b
Not currently on any branch.
nothing to commit, working tree clean
> git branch
* (no branch)
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Checkout a tag:
Then run a go program that uses
go-git
like so:The output shows that
Name()
returnsHEAD
andIsTag()
returns false.The text was updated successfully, but these errors were encountered: