Reference: expose Peel()
Peel a reference to a particular type of object, returning an Object, which you then perform a type assertion on.
This commit is contained in:
parent
f5e1252d6e
commit
22bcd7decf
13
reference.go
13
reference.go
|
@ -148,6 +148,19 @@ func (v *Reference) Delete() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *Reference) Peel(t ObjectType) (Object, error) {
|
||||||
|
var cobj *C.git_object
|
||||||
|
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
if err := C.git_reference_peel(&cobj, v.ptr, C.git_otype(t)); err < 0 {
|
||||||
|
return nil, MakeGitError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return allocObject(cobj), nil
|
||||||
|
}
|
||||||
|
|
||||||
// Cmp compares both references, retursn 0 on equality, otherwise a
|
// Cmp compares both references, retursn 0 on equality, otherwise a
|
||||||
// stable sorting.
|
// stable sorting.
|
||||||
func (v *Reference) Cmp(ref2 *Reference) int {
|
func (v *Reference) Cmp(ref2 *Reference) int {
|
||||||
|
|
Loading…
Reference in New Issue