Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 0381008

Browse files
authored
Merge pull request #828 from fooker/patch-1
Use remote name in fetch while clone
2 parents 0bfe038 + 529f843 commit 0381008

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

repository.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,12 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {
654654
}
655655

656656
ref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{
657-
RefSpecs: r.cloneRefSpec(o, c),
658-
Depth: o.Depth,
659-
Auth: o.Auth,
660-
Progress: o.Progress,
661-
Tags: o.Tags,
657+
RefSpecs: r.cloneRefSpec(o, c),
658+
Depth: o.Depth,
659+
Auth: o.Auth,
660+
Progress: o.Progress,
661+
Tags: o.Tags,
662+
RemoteName: o.RemoteName,
662663
}, o.ReferenceName)
663664
if err != nil {
664665
return err

repository_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,19 @@ func (s *RepositorySuite) TestPlainClone(c *C) {
568568
c.Assert(cfg.Branches["master"].Name, Equals, "master")
569569
}
570570

571+
func (s *RepositorySuite) TestPlainCloneWithRemoteName(c *C) {
572+
r, err := PlainClone(c.MkDir(), false, &CloneOptions{
573+
URL: s.GetBasicLocalRepositoryURL(),
574+
RemoteName: "test",
575+
})
576+
577+
c.Assert(err, IsNil)
578+
579+
remote, err := r.Remote("test")
580+
c.Assert(err, IsNil)
581+
c.Assert(remote, NotNil)
582+
}
583+
571584
func (s *RepositorySuite) TestPlainCloneContext(c *C) {
572585
ctx, cancel := context.WithCancel(context.Background())
573586
cancel()

0 commit comments

Comments
 (0)