From 63116ea57e6920b25d7410eda2fc1c786be8a819 Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Sat, 13 Dec 2014 00:25:11 +0100 Subject: Update to master This deprecates the Push struct in favour of Remote.Push() --- remote.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'remote.go') 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 +} -- cgit v1.2.3