diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-01-09 10:17:55 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-01-09 10:17:55 +0100 |
| commit | d260f21be3ae02814a23d6d077e29da63b983b77 (patch) | |
| tree | 4819dae68b0c7fe9844c2bb8010995cc70f6be43 /remote.go | |
| parent | d54ebd5f5b29a4a893f0a58d0911bf94aa497087 (diff) | |
| parent | dbddb88a8cf1302049bcfaccf25aba21b2224f10 (diff) | |
Merge pull request #165 from calavera/remote_prune_refs
Add prune methods to Remote.
Diffstat (limited to 'remote.go')
| -rw-r--r-- | remote.go | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -69,7 +69,6 @@ type RemoteCallbacks struct { PushUpdateReferenceCallback } - type Remote struct { ptr *C.git_remote callbacks RemoteCallbacks @@ -259,8 +258,6 @@ func pushUpdateReferenceCallback(refname, status *C.char, data unsafe.Pointer) i return int(callbacks.PushUpdateReferenceCallback(C.GoString(refname), C.GoString(status))) } - - func RemoteIsValidName(name string) bool { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) @@ -330,7 +327,7 @@ func (repo *Repository) CreateRemote(name string, url string) (*Remote, error) { func (repo *Repository) DeleteRemote(name string) error { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) - + runtime.LockOSThread() defer runtime.UnlockOSThread() @@ -722,8 +719,8 @@ func (o *Remote) Push(refspecs []string, opts *PushOptions, sig *Signature, msg crefspecs.strings = makeCStringsFromStrings(refspecs) defer freeStrarray(&crefspecs) - runtime.LockOSThread() - defer runtime.UnlockOSThread() + runtime.LockOSThread() + defer runtime.UnlockOSThread() ret := C.git_remote_push(o.ptr, &crefspecs, &copts, csig, cmsg) if ret < 0 { @@ -731,3 +728,18 @@ func (o *Remote) Push(refspecs []string, opts *PushOptions, sig *Signature, msg } return nil } + +func (o *Remote) PruneRefs() bool { + return C.git_remote_prune_refs(o.ptr) > 0 +} + +func (o *Remote) Prune() error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ret := C.git_remote_prune(o.ptr) + if ret < 0 { + return MakeGitError(ret) + } + return nil +} |
