Reputation: 4380
I initially thought this should be trivial, but how exactly can one get the commit to which a Tag
object refers to in LibGit2Sharp?
Naively I thought we could get the sha by using Tag.TargetIdentifier
but that points to the sha of the tag reference, not of the commit.
Then I thought that we could use Tag.ResolveToDirectReference()
to peel away until we get to the commit, but this seems to return the same object.
The frustrating observation is that when inspecting the Tag
object in the debugger there is a Target
property which inside has another Target
property that points to the commit, but I can't seem to access it anywhere in the API (even though it is not clearly marked as internal or private in the debugger).
There must be something really obvious I am missing but I couldn't find it from all the searches I've run.
Upvotes: 1
Views: 91
Reputation: 4380
Nevermind, in the end it was trivial, but I had changed the way that I was reading in tags to use the Refs
collection which returns a Reference
object and not the Tag
object where all the properties are indeed exposed.
The answer I was looking for with a proper Tag
object is simply:
tag.Target == commit
Upvotes: 1