diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-08-09 10:37:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 10:37:40 +0200 |
commit | c3740924da0d1929cb523c85ae9da3b456b901ea (patch) | |
tree | fd1664bfb917a5455cf64ad0db13d7b8add57ed5 /repository.go | |
parent | 43d17e14b714665ab5bc2ecc220b6740779d733f (diff) | |
parent | 7b1248177ad3533c63590c7c47495f28f0f3da71 (diff) | |
download | go-git-c3740924da0d1929cb523c85ae9da3b456b901ea.tar.gz |
Merge pull request #910 from fkorotkov/fedor/fix-tag-cloning
Fixed cloning of a single tag
Diffstat (limited to 'repository.go')
-rw-r--r-- | repository.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/repository.go b/repository.go index 54572bc..818cfb3 100644 --- a/repository.go +++ b/repository.go @@ -583,7 +583,7 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error { } const ( - refspecTagWithDepth = "+refs/tags/%s:refs/tags/%[1]s" + refspecTag = "+refs/tags/%s:refs/tags/%[1]s" refspecSingleBranch = "+refs/heads/%s:refs/remotes/%s/%[1]s" refspecSingleBranchHEAD = "+HEAD:refs/remotes/%s/HEAD" ) @@ -592,8 +592,8 @@ func (r *Repository) cloneRefSpec(o *CloneOptions, c *config.RemoteConfig) []con var rs string switch { - case o.ReferenceName.IsTag() && o.Depth > 0: - rs = fmt.Sprintf(refspecTagWithDepth, o.ReferenceName.Short()) + case o.ReferenceName.IsTag(): + rs = fmt.Sprintf(refspecTag, o.ReferenceName.Short()) case o.SingleBranch && o.ReferenceName == plumbing.HEAD: rs = fmt.Sprintf(refspecSingleBranchHEAD, c.Name) case o.SingleBranch: |