diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-09-04 13:54:02 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-09-04 13:54:02 +0200 |
commit | 7cdc44306dd1b3bba4a219bf3c40c5097a505a8e (patch) | |
tree | 2a6300e33f07f54cb1f7756100386430215a11d7 /repository_test.go | |
parent | 38b9d5711a0d8156a5b5b1e5dd9972558b1389a7 (diff) | |
download | go-git-7cdc44306dd1b3bba4a219bf3c40c5097a505a8e.tar.gz |
Repository.Clone added Tags option, and set by default AllTags as git does
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 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{ |