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

Function dupObject

object.go:91–108  ·  view source on GitHub ↗
(obj *Object, kind ObjectType)

Source from the content-addressed store, hash-verified

89}
90
91func dupObject(obj *Object, kind ObjectType) (*C.git_object, error) {
92 if obj.Type() != kind {
93 return nil, errors.New(fmt.Sprintf("object is not a %v", kind))
94 }
95
96 var cobj *C.git_object
97
98 runtime.LockOSThread()
99 defer runtime.UnlockOSThread()
100
101 err := C.git_object_dup(&cobj, obj.ptr)
102 runtime.KeepAlive(obj)
103 if err < 0 {
104 return nil, MakeGitError(err)
105 }
106
107 return cobj, nil
108}
109
110func allocTree(ptr *C.git_tree, repo *Repository) *Tree {
111 tree := &Tree{

Callers 4

AsTreeMethod · 0.85
AsCommitMethod · 0.85
AsBlobMethod · 0.85
AsTagMethod · 0.85

Calls 2

MakeGitErrorFunction · 0.85
TypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…