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

Commit 7002a5e

Browse files
committed
use remote name in fetch while clone, test
1 parent 2eb97fb commit 7002a5e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

repository.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {
519519
}
520520

521521
ref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{
522-
RefSpecs: r.cloneRefSpec(o, c),
522+
RefSpecs: r.cloneRefSpec(o, c),
523523
Depth: o.Depth,
524524
Auth: o.Auth,
525525
Progress: o.Progress,

repository_test.go

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

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

0 commit comments

Comments
 (0)