diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-11-07 16:20:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-07 16:20:19 +0100 |
commit | a779a263330bc497181136072e7a484fefb51323 (patch) | |
tree | 6556b6eca1b9c0d34312b7d68075c218060f42bf /repository_test.go | |
parent | 91e601df9b000c7127e0238785e8a9018fcad54a (diff) | |
parent | 3ab4ee58fe422467be6f7a9257775685a7192e03 (diff) | |
download | go-git-a779a263330bc497181136072e7a484fefb51323.tar.gz |
Merge pull request #1015 from fkorotkov/fedor/fix-tag-clonning
repository: Fix RefSpec for a single tag.
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go index ba2cf1a..59ab89e 100644 --- a/repository_test.go +++ b/repository_test.go @@ -919,6 +919,32 @@ func (s *RepositorySuite) TestCloneSingleBranch(c *C) { c.Assert(branch.Hash().String(), Equals, "6ecf0ef2c2dffb796033e5a02219af86ec6584e5") } +func (s *RepositorySuite) TestCloneSingleTag(c *C) { + r, _ := Init(memory.NewStorage(), nil) + + url := s.GetLocalRepositoryURL( + fixtures.ByURL("https://github.com/git-fixtures/tags.git").One(), + ) + + err := r.clone(context.Background(), &CloneOptions{ + URL: url, + SingleBranch: true, + ReferenceName: plumbing.ReferenceName("refs/tags/commit-tag"), + }) + c.Assert(err, IsNil) + + branch, err := r.Reference("refs/tags/commit-tag", false) + c.Assert(err, IsNil) + c.Assert(branch, NotNil) + + conf, err := r.Config() + c.Assert(err, IsNil) + originRemote := conf.Remotes["origin"] + c.Assert(originRemote, NotNil) + c.Assert(originRemote.Fetch, HasLen, 1) + c.Assert(originRemote.Fetch[0].String(), Equals, "+refs/tags/commit-tag:refs/tags/commit-tag") +} + func (s *RepositorySuite) TestCloneDetachedHEAD(c *C) { r, _ := Init(memory.NewStorage(), nil) err := r.clone(context.Background(), &CloneOptions{ |