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

Commit 4d0c2cc

Browse files
committed
Create ListOptions and rename LSRemote to List.
1 parent 7172e04 commit 4d0c2cc

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,9 @@ func (o *CommitOptions) Validate(r *Repository) error {
348348

349349
return nil
350350
}
351+
352+
// ListOptions describes how a remote list should be performed.
353+
type ListOptions struct {
354+
// Auth credentials, if required, to use with the remote repository.
355+
Auth transport.AuthMethod
356+
}

remote.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,9 @@ func (r *Remote) buildFetchedTags(refs memory.ReferenceStorage) (updated bool, e
728728
return
729729
}
730730

731-
// LSRemote performs ls-remote on the remote.
732-
func (r *Remote) LSRemote(auth transport.AuthMethod) ([]*plumbing.Reference, error) {
733-
s, err := newUploadPackSession(r.c.URLs[0], auth)
731+
// List the references on the remote repository.
732+
func (r *Remote) List(o *ListOptions) ([]*plumbing.Reference, error) {
733+
s, err := newUploadPackSession(r.c.URLs[0], o.Auth)
734734
if err != nil {
735735
return nil, err
736736
}

remote_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"gopkg.in/src-d/go-git.v4/config"
1212
"gopkg.in/src-d/go-git.v4/plumbing"
1313
"gopkg.in/src-d/go-git.v4/plumbing/storer"
14-
"gopkg.in/src-d/go-git.v4/plumbing/transport"
1514
"gopkg.in/src-d/go-git.v4/storage"
1615
"gopkg.in/src-d/go-git.v4/storage/filesystem"
1716
"gopkg.in/src-d/go-git.v4/storage/memory"
@@ -644,7 +643,7 @@ func (s *RemoteSuite) TestGetHaves(c *C) {
644643
c.Assert(l, HasLen, 2)
645644
}
646645

647-
func (s *RemoteSuite) TestLSRemote(c *C) {
646+
func (s *RemoteSuite) TestList(c *C) {
648647
url := c.MkDir()
649648
server, err := PlainInit(url, true)
650649
c.Assert(err, IsNil)
@@ -664,9 +663,8 @@ func (s *RemoteSuite) TestLSRemote(c *C) {
664663
})
665664
c.Assert(err, IsNil)
666665

667-
// Perform ls-remote.
668-
var authMethod transport.AuthMethod
669-
refs, err := remote.LSRemote(authMethod)
666+
listOptions := ListOptions{}
667+
refs, err := remote.List(&listOptions)
670668
c.Assert(err, IsNil)
671669

672670
// Create a map of remote name and their hash.

0 commit comments

Comments
 (0)