MCPcopy Create free account
hub / github.com/libgit2/git2go / RevparseExt

Method RevparseExt

revparse.go:94–114  ·  view source on GitHub ↗
(spec string)

Source from the content-addressed store, hash-verified

92}
93
94func (r *Repository) RevparseExt(spec string) (*Object, *Reference, error) {
95 cspec := C.CString(spec)
96 defer C.free(unsafe.Pointer(cspec))
97
98 var obj *C.git_object
99 var ref *C.git_reference
100
101 runtime.LockOSThread()
102 defer runtime.UnlockOSThread()
103
104 ecode := C.git_revparse_ext(&obj, &ref, r.ptr, cspec)
105 if ecode != 0 {
106 return nil, nil, MakeGitError(ecode)
107 }
108
109 if ref == nil {
110 return allocObject(obj, r), nil, nil
111 }
112
113 return allocObject(obj, r), newReferenceFromC(ref, r), nil
114}

Callers 1

TestRevparseExtFunction · 0.80

Calls 4

MakeGitErrorFunction · 0.85
allocObjectFunction · 0.85
newReferenceFromCFunction · 0.85
freeMethod · 0.80

Tested by 1

TestRevparseExtFunction · 0.64