diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-10-15 12:30:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 12:30:29 +0200 |
commit | 8153e040f68da6002096ef177a11510f4fb06769 (patch) | |
tree | bb595fba595a07ab2178096a421fc827afae4a1d /repository_test.go | |
parent | 345ffd95a2cd1413d7f48280e21a035febbe4e10 (diff) | |
parent | 323d084635349bf9dbe7b29d1a20442a204ad2b1 (diff) | |
download | go-git-8153e040f68da6002096ef177a11510f4fb06769.tar.gz |
Merge pull request #830 from novas0x2a/annotated
Teach ResolveRevision how to look up annotated tags
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/repository_test.go b/repository_test.go index 6d34d42..6c8014c 100644 --- a/repository_test.go +++ b/repository_test.go @@ -2065,7 +2065,25 @@ func (s *RepositorySuite) TestResolveRevision(c *C) { h, err := r.ResolveRevision(plumbing.Revision(rev)) c.Assert(err, IsNil) - c.Assert(h.String(), Equals, hash) + c.Check(h.String(), Equals, hash, Commentf("while checking %s", rev)) + } +} + +func (s *RepositorySuite) TestResolveRevisionAnnotated(c *C) { + f := fixtures.ByURL("https://github.com/git-fixtures/tags.git").One() + sto := filesystem.NewStorage(f.DotGit(), cache.NewObjectLRUDefault()) + r, err := Open(sto, f.DotGit()) + c.Assert(err, IsNil) + + datas := map[string]string{ + "refs/tags/annotated-tag": "f7b877701fbf855b44c0a9e86f3fdce2c298b07f", + } + + for rev, hash := range datas { + h, err := r.ResolveRevision(plumbing.Revision(rev)) + + c.Assert(err, IsNil) + c.Check(h.String(), Equals, hash, Commentf("while checking %s", rev)) } } |