diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-10-15 11:32:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 11:32:41 +0200 |
commit | 03810084a0cdb9eb432651979b0784a9fd92736a (patch) | |
tree | f42fdd38eeb25fbbf53fc19b4fd04cd6f7f25124 | |
parent | 0bfe038a16551ede1d22bfb54f52c31b646a9e1a (diff) | |
parent | 529f8438980a29999ca44f3a3e74eb317d0cf3c5 (diff) | |
download | go-git-03810084a0cdb9eb432651979b0784a9fd92736a.tar.gz |
Merge pull request #828 from fooker/patch-1
Use remote name in fetch while clone
-rw-r--r-- | repository.go | 11 | ||||
-rw-r--r-- | repository_test.go | 13 |
2 files changed, 19 insertions, 5 deletions
diff --git a/repository.go b/repository.go index 62e22a6..ddf6727 100644 --- a/repository.go +++ b/repository.go @@ -654,11 +654,12 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error { } ref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{ - RefSpecs: r.cloneRefSpec(o, c), - Depth: o.Depth, - Auth: o.Auth, - Progress: o.Progress, - Tags: o.Tags, + RefSpecs: r.cloneRefSpec(o, c), + Depth: o.Depth, + Auth: o.Auth, + Progress: o.Progress, + Tags: o.Tags, + RemoteName: o.RemoteName, }, o.ReferenceName) if err != nil { return err diff --git a/repository_test.go b/repository_test.go index bf02933..6d34d42 100644 --- a/repository_test.go +++ b/repository_test.go @@ -568,6 +568,19 @@ func (s *RepositorySuite) TestPlainClone(c *C) { c.Assert(cfg.Branches["master"].Name, Equals, "master") } +func (s *RepositorySuite) TestPlainCloneWithRemoteName(c *C) { + r, err := PlainClone(c.MkDir(), false, &CloneOptions{ + URL: s.GetBasicLocalRepositoryURL(), + RemoteName: "test", + }) + + c.Assert(err, IsNil) + + remote, err := r.Remote("test") + c.Assert(err, IsNil) + c.Assert(remote, NotNil) +} + func (s *RepositorySuite) TestPlainCloneContext(c *C) { ctx, cancel := context.WithCancel(context.Background()) cancel() |