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

Method CheckoutTree

checkout.go:248–267  ·  view source on GitHub ↗
(tree *Tree, opts *CheckoutOptions)

Source from the content-addressed store, hash-verified

246}
247
248func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOptions) error {
249 runtime.LockOSThread()
250 defer runtime.UnlockOSThread()
251
252 var err error
253 cOpts := populateCheckoutOptions(&C.git_checkout_options{}, opts, &err)
254 defer freeCheckoutOptions(cOpts)
255
256 ret := C.git_checkout_tree(v.ptr, tree.ptr, cOpts)
257 runtime.KeepAlive(v)
258 runtime.KeepAlive(tree)
259 if ret == C.int(ErrorCodeUser) && err != nil {
260 return err
261 }
262 if ret < 0 {
263 return MakeGitError(ret)
264 }
265
266 return nil
267}

Callers 1

checkoutFunction · 0.80

Calls 3

populateCheckoutOptionsFunction · 0.85
freeCheckoutOptionsFunction · 0.85
MakeGitErrorFunction · 0.85

Tested by 1

checkoutFunction · 0.64