summaryrefslogtreecommitdiff
path: root/remote.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-03-21 05:29:05 +0100
committerCarlos Martín Nieto <[email protected]>2014-03-21 05:29:05 +0100
commitb86977566540e2b8bea0ebba194445b98c0dc19f (patch)
treef3ccf450fb7699b907c517cf4218bee70ce04333 /remote.go
parent574f0dd12da2eae6f26ae35f197b2ec7a9328249 (diff)
parent5d8db7f9362a314cf56747cf23605aec8640e92e (diff)
Merge pull request #70 from jezell/add-remote-list
Add git_remote_list + test
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/remote.go b/remote.go
index d556f99..66097b8 100644
--- a/remote.go
+++ b/remote.go
@@ -132,6 +132,18 @@ func (r *Remote) Free() {
C.git_remote_free(r.ptr)
}
+func (repo *Repository) ListRemotes() ([]string, error) {
+ var r C.git_strarray
+ ecode := C.git_remote_list(&r, repo.ptr)
+ if ecode < 0 {
+ return nil, MakeGitError(ecode)
+ }
+ defer C.git_strarray_free(&r)
+
+ remotes := makeStringsFromCStrings(r.strings, int(r.count))
+ return remotes, nil
+}
+
func (repo *Repository) CreateRemote(name string, url string) (*Remote, error) {
remote := &Remote{}