summaryrefslogtreecommitdiff
path: root/remote.go
diff options
context:
space:
mode:
authorDavid Calavera <[email protected]>2014-10-27 08:29:42 -0700
committerDavid Calavera <[email protected]>2014-10-27 08:29:42 -0700
commitd1b87efd96b30b8e1fc892a8c791e042676f9a38 (patch)
tree5a177ecb2c37dc7142933c8c4cdac9fc6d295cbb /remote.go
parent749d6149b31b17aab4ca58a2e48d73361547fc3e (diff)
Add connect methods to Remote.
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/remote.go b/remote.go
index 139e71b..a3b4c6c 100644
--- a/remote.go
+++ b/remote.go
@@ -41,8 +41,8 @@ const (
RemoteCompletionDownload RemoteCompletion = C.GIT_REMOTE_COMPLETION_DOWNLOAD
RemoteCompletionIndexing = C.GIT_REMOTE_COMPLETION_INDEXING
RemoteCompletionError = C.GIT_REMOTE_COMPLETION_ERROR
-
- RemoteFetchDirection = C.GIT_DIRECTION_FETCH
+ RemoteDirectionFetch = C.GIT_DIRECTION_FETCH
+ RemoteDirectionPush = C.GIT_DIRECTION_PUSH
)
type TransportMessageCallback func(str string) int
@@ -564,10 +564,25 @@ func (o *Remote) Fetch(refspecs []string, sig *Signature, msg string) error {
return nil
}
-func (o *Remote) Ls(filterRefs ...string) ([]RemoteHead, error) {
- if ret := C.git_remote_connect(o.ptr, RemoteFetchDirection); ret != 0 {
- return nil, MakeGitError(ret)
+func (o *Remote) ConnectFetch() error {
+ return o.Connect(RemoteDirectionFetch)
+}
+
+func (o *Remote) ConnectPush() error {
+ return o.Connect(RemoteDirectionPush)
+}
+
+func (o *Remote) Connect(direction C.git_direction) error {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ if ret := C.git_remote_connect(o.ptr, direction); ret != 0 {
+ return MakeGitError(ret)
}
+ return nil
+}
+
+func (o *Remote) Ls(filterRefs ...string) ([]RemoteHead, error) {
var refs **C.git_remote_head
var length C.size_t