Add missing walk functions #76
|
@ -287,22 +287,22 @@ func (sub *Submodule) Open() (*Repository, error) {
|
||||||
return repo, nil
|
return repo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sub *Submodule) Reload() error {
|
func (sub *Submodule) Reload(force bool) error {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
defer runtime.UnlockOSThread()
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
ret := C.git_submodule_reload(sub.ptr)
|
ret := C.git_submodule_reload(sub.ptr, cbool(force))
|
||||||
if ret < 0 {
|
if ret < 0 {
|
||||||
return MakeGitError(ret)
|
return MakeGitError(ret)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) ReloadAllSubmodules() error {
|
func (repo *Repository) ReloadAllSubmodules(force bool) error {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
defer runtime.UnlockOSThread()
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
ret := C.git_submodule_reload_all(repo.ptr)
|
ret := C.git_submodule_reload_all(repo.ptr, cbool(force))
|
||||||
if ret < 0 {
|
if ret < 0 {
|
||||||
return MakeGitError(ret)
|
return MakeGitError(ret)
|
||||||
}
|
}
|
||||||
|
|
105
walk.go
105
walk.go
|
@ -9,6 +9,7 @@ import "C"
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RevWalk
|
// RevWalk
|
||||||
|
@ -37,8 +38,57 @@ func (v *RevWalk) Reset() {
|
||||||
C.git_revwalk_reset(v.ptr)
|
C.git_revwalk_reset(v.ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *RevWalk) Push(id *Oid) {
|
func (v *RevWalk) Push(id *Oid) error {
|
||||||
C.git_revwalk_push(v.ptr, id.toC())
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_push(v.ptr, id.toC())
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *RevWalk) PushGlob(glob string) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cstr := C.CString(glob)
|
||||||
|
defer C.free(unsafe.Pointer(cstr))
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_push_glob(v.ptr, cstr)
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *RevWalk) PushRange(r string) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cstr := C.CString(r)
|
||||||
|
defer C.free(unsafe.Pointer(cstr))
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_push_range(v.ptr, cstr)
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *RevWalk) PushRef(r string) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cstr := C.CString(r)
|
||||||
|
defer C.free(unsafe.Pointer(cstr))
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_push_ref(v.ptr, cstr)
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *RevWalk) PushHead() (err error) {
|
func (v *RevWalk) PushHead() (err error) {
|
||||||
|
@ -49,8 +99,57 @@ func (v *RevWalk) PushHead() (err error) {
|
||||||
if ecode < 0 {
|
if ecode < 0 {
|
||||||
err = MakeGitError(ecode)
|
err = MakeGitError(ecode)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return
|
func (v *RevWalk) Hide(id *Oid) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_hide(v.ptr, id.toC())
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *RevWalk) HideGlob(glob string) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cstr := C.CString(glob)
|
||||||
|
defer C.free(unsafe.Pointer(cstr))
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_hide_glob(v.ptr, cstr)
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *RevWalk) HideRef(r string) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cstr := C.CString(r)
|
||||||
|
defer C.free(unsafe.Pointer(cstr))
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_hide_ref(v.ptr, cstr)
|
||||||
|
if ecode < 0 {
|
||||||
|
return MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *RevWalk) HideHead() (err error) {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
ecode := C.git_revwalk_hide_head(v.ptr)
|
||||||
|
if ecode < 0 {
|
||||||
|
err = MakeGitError(ecode)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *RevWalk) Next(id *Oid) (err error) {
|
func (v *RevWalk) Next(id *Oid) (err error) {
|
||||||
|
|
Loading…
Reference in New Issue