summaryrefslogtreecommitdiff
path: root/remote.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-12-13 00:25:11 +0100
committerCarlos Martín Nieto <[email protected]>2014-12-13 00:25:11 +0100
commit63116ea57e6920b25d7410eda2fc1c786be8a819 (patch)
treee04fa2c9fd211ea6d662a7da2beef65279f967d5 /remote.go
parenta9d993f3d1400970bfba572747edbee1b57fd221 (diff)
Update to master
This deprecates the Push struct in favour of Remote.Push()
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/remote.go b/remote.go
index 604ef40..021e207 100644
--- a/remote.go
+++ b/remote.go
@@ -650,3 +650,40 @@ func (o *Remote) Ls(filterRefs ...string) ([]RemoteHead, error) {
return heads, nil
}
+
+func (o *Remote) Push(refspecs []string, opts *PushOptions, sig *Signature, msg string) error {
+ var csig *C.git_signature = nil
+ if sig != nil {
+ csig = sig.toC()
+ defer C.free(unsafe.Pointer(csig))
+ }
+
+ var cmsg *C.char
+ if msg == "" {
+ cmsg = nil
+ } else {
+ cmsg = C.CString(msg)
+ defer C.free(unsafe.Pointer(cmsg))
+ }
+
+ var copts C.git_push_options
+ C.git_push_init_options(&copts, C.GIT_PUSH_OPTIONS_VERSION)
+ if opts != nil {
+ copts.version = C.uint(opts.Version)
+ copts.pb_parallelism = C.uint(opts.PbParallelism)
+ }
+
+ crefspecs := C.git_strarray{}
+ crefspecs.count = C.size_t(len(refspecs))
+ crefspecs.strings = makeCStringsFromStrings(refspecs)
+ defer freeStrarray(&crefspecs)
+
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ret := C.git_remote_push(o.ptr, &crefspecs, &copts, csig, cmsg)
+ if ret < 0 {
+ return MakeGitError(ret)
+ }
+ return nil
+}