aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-08-27 23:51:24 +0200
committerGitHub <noreply@github.com>2017-08-27 23:51:24 +0200
commit631a45f55b397090ad7d817a3c72041cfc3729f3 (patch)
tree955d20a91cc0b4753f9b7aedc7517601a9b51228 /repository_test.go
parent334923a20db4c8bd89e6197f99051839eac1731b (diff)
parent17cde59e5ced61adece4741b3a4da947f08fd9dc (diff)
downloadgo-git-631a45f55b397090ad7d817a3c72041cfc3729f3.tar.gz
Merge pull request #558 from orirawlings/cloneAnnotatedTag
repository: Resolve commit when cloning annotated tag, fixes #557
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go21
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)