diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-10-15 12:18:42 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2018-10-15 12:18:42 +0200 |
commit | 0b7d3fe0a47bd7da9c42ba34b9098441120bda02 (patch) | |
tree | 454c77ff55464c80f4553fd642cd17a496d1630e | |
parent | 5dd9376f01fd2c397607ac333683c0bd676bed6a (diff) | |
download | go-git-0b7d3fe0a47bd7da9c42ba34b9098441120bda02.tar.gz |
teach ResolveRevision how to look up annotated tags, test
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
-rw-r--r-- | repository_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go index e6978b9..0a0d361 100644 --- a/repository_test.go +++ b/repository_test.go @@ -1505,6 +1505,25 @@ func (s *RepositorySuite) TestResolveRevision(c *C) { } } +func (s *RepositorySuite) TestResolveRevisionAnnotated(c *C) { + f := fixtures.ByURL("https://github.com/git-fixtures/tags.git").One() + sto, err := filesystem.NewStorage(f.DotGit()) + c.Assert(err, IsNil) + 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)) + } +} + func (s *RepositorySuite) TestResolveRevisionWithErrors(c *C) { url := s.GetLocalRepositoryURL( fixtures.ByURL("https://github.com/git-fixtures/basic.git").One(), |