aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny <me@darkowlzz.space>2017-10-04 01:59:13 +0530
committerSunny <me@darkowlzz.space>2017-10-04 01:59:13 +0530
commit4d0c2cccb890be585b74fea3805db6e555f42cfc (patch)
tree1ffa756b197c8e38b10e019fd1e0aa3e16be0f19
parent7172e04fe7e000d8826f0402dd7f70d8b3d55072 (diff)
downloadgo-git-4d0c2cccb890be585b74fea3805db6e555f42cfc.tar.gz
Create ListOptions and rename LSRemote to List.
-rw-r--r--options.go6
-rw-r--r--remote.go6
-rw-r--r--remote_test.go8
3 files changed, 12 insertions, 8 deletions
diff --git a/options.go b/options.go
index 9f10aae..7036bc1 100644
--- a/options.go
+++ b/options.go
@@ -348,3 +348,9 @@ func (o *CommitOptions) Validate(r *Repository) error {
return nil
}
+
+// ListOptions describes how a remote list should be performed.
+type ListOptions struct {
+ // Auth credentials, if required, to use with the remote repository.
+ Auth transport.AuthMethod
+}
diff --git a/remote.go b/remote.go
index c297e8e..1b8b502 100644
--- a/remote.go
+++ b/remote.go
@@ -728,9 +728,9 @@ func (r *Remote) buildFetchedTags(refs memory.ReferenceStorage) (updated bool, e
return
}
-// LSRemote performs ls-remote on the remote.
-func (r *Remote) LSRemote(auth transport.AuthMethod) ([]*plumbing.Reference, error) {
- s, err := newUploadPackSession(r.c.URLs[0], auth)
+// List the references on the remote repository.
+func (r *Remote) List(o *ListOptions) ([]*plumbing.Reference, error) {
+ s, err := newUploadPackSession(r.c.URLs[0], o.Auth)
if err != nil {
return nil, err
}
diff --git a/remote_test.go b/remote_test.go
index 4bb2037..f5f6817 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -11,7 +11,6 @@ import (
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
- "gopkg.in/src-d/go-git.v4/plumbing/transport"
"gopkg.in/src-d/go-git.v4/storage"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
"gopkg.in/src-d/go-git.v4/storage/memory"
@@ -644,7 +643,7 @@ func (s *RemoteSuite) TestGetHaves(c *C) {
c.Assert(l, HasLen, 2)
}
-func (s *RemoteSuite) TestLSRemote(c *C) {
+func (s *RemoteSuite) TestList(c *C) {
url := c.MkDir()
server, err := PlainInit(url, true)
c.Assert(err, IsNil)
@@ -664,9 +663,8 @@ func (s *RemoteSuite) TestLSRemote(c *C) {
})
c.Assert(err, IsNil)
- // Perform ls-remote.
- var authMethod transport.AuthMethod
- refs, err := remote.LSRemote(authMethod)
+ listOptions := ListOptions{}
+ refs, err := remote.List(&listOptions)
c.Assert(err, IsNil)
// Create a map of remote name and their hash.