From 7cdc44306dd1b3bba4a219bf3c40c5097a505a8e Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Mon, 4 Sep 2017 13:54:02 +0200 Subject: Repository.Clone added Tags option, and set by default AllTags as git does --- repository_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'repository_test.go') diff --git a/repository_test.go b/repository_test.go index 6184949..4480484 100644 --- a/repository_test.go +++ b/repository_test.go @@ -177,6 +177,27 @@ func (s *RepositorySuite) TestCloneContext(c *C) { c.Assert(err, NotNil) } +func (s *RepositorySuite) TestCloneWithTags(c *C) { + url := s.GetLocalRepositoryURL( + fixtures.ByURL("https://github.com/git-fixtures/tags.git").One(), + ) + + r, err := Clone(memory.NewStorage(), nil, &CloneOptions{URL: url, Tags: NoTags}) + c.Assert(err, IsNil) + + remotes, err := r.Remotes() + c.Assert(err, IsNil) + c.Assert(remotes, HasLen, 1) + + i, err := r.References() + c.Assert(err, IsNil) + + var count int + i.ForEach(func(r *plumbing.Reference) error { count++; return nil }) + + c.Assert(count, Equals, 3) +} + func (s *RepositorySuite) TestCreateRemoteAndRemote(c *C) { r, _ := Init(memory.NewStorage(), nil) remote, err := r.CreateRemote(&config.RemoteConfig{ -- cgit