Skip to content

Commit

Permalink
use remote name in fetch while clone, test
Browse files Browse the repository at this point in the history
Signed-off-by: Máximo Cuadros <[email protected]>
  • Loading branch information
mcuadros committed Oct 15, 2018
1 parent 2eb97fb commit 529f843
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {
}

ref, err := r.fetchAndUpdateReferences(ctx, &FetchOptions{
RefSpecs: r.cloneRefSpec(o, c),
RefSpecs: r.cloneRefSpec(o, c),
Depth: o.Depth,
Auth: o.Auth,
Progress: o.Progress,
Expand Down
13 changes: 13 additions & 0 deletions repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,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()
Expand Down

0 comments on commit 529f843

Please sign in to comment.