diff options
author | Ori Rawlings <orirawlings@gmail.com> | 2017-08-23 22:39:25 -0500 |
---|---|---|
committer | Ori Rawlings <orirawlings@gmail.com> | 2017-08-24 21:33:26 -0500 |
commit | 17cde59e5ced61adece4741b3a4da947f08fd9dc (patch) | |
tree | 1140da6b43be938260f6ee7206303de2604e1ce5 /repository_test.go | |
parent | 2f58c82181c30a9d9090173601660d88fba06958 (diff) | |
download | go-git-17cde59e5ced61adece4741b3a4da947f08fd9dc.tar.gz |
repository: Resolve commit when cloning annotated tag, fixes #557
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go index 3da11f6..e944251 100644 --- a/repository_test.go +++ b/repository_test.go @@ -651,6 +651,27 @@ func (s *RepositorySuite) TestCloneDetachedHEADAndShallow(c *C) { c.Assert(count, Equals, 15) } +func (s *RepositorySuite) TestCloneDetachedHEADAnnotatedTag(c *C) { + r, _ := Init(memory.NewStorage(), nil) + err := r.clone(context.Background(), &CloneOptions{ + URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()), + ReferenceName: plumbing.ReferenceName("refs/tags/annotated-tag"), + }) + c.Assert(err, IsNil) + + head, err := r.Reference(plumbing.HEAD, false) + c.Assert(err, IsNil) + c.Assert(head, NotNil) + c.Assert(head.Type(), Equals, plumbing.HashReference) + c.Assert(head.Hash().String(), Equals, "f7b877701fbf855b44c0a9e86f3fdce2c298b07f") + + count := 0 + objects, err := r.Objects() + c.Assert(err, IsNil) + objects.ForEach(func(object.Object) error { count++; return nil }) + c.Assert(count, Equals, 7) +} + func (s *RepositorySuite) TestPush(c *C) { url := c.MkDir() server, err := PlainInit(url, true) |