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

Function checkoutNotifyCallback

checkout.go:95–124  ·  view source on GitHub ↗

export checkoutNotifyCallback

(
	why C.git_checkout_notify_t,
	cpath *C.char,
	cbaseline, ctarget, cworkdir, handle unsafe.Pointer,
)

Source from the content-addressed store, hash-verified

93
94//export checkoutNotifyCallback
95func checkoutNotifyCallback(
96 why C.git_checkout_notify_t,
97 cpath *C.char,
98 cbaseline, ctarget, cworkdir, handle unsafe.Pointer,
99) C.int {
100 if handle == nil {
101 return C.int(ErrorCodeOK)
102 }
103 path := C.GoString(cpath)
104 var baseline, target, workdir DiffFile
105 if cbaseline != nil {
106 baseline = diffFileFromC((*C.git_diff_file)(cbaseline))
107 }
108 if ctarget != nil {
109 target = diffFileFromC((*C.git_diff_file)(ctarget))
110 }
111 if cworkdir != nil {
112 workdir = diffFileFromC((*C.git_diff_file)(cworkdir))
113 }
114 data := pointerHandles.Get(handle).(*checkoutCallbackData)
115 if data.options.NotifyCallback == nil {
116 return C.int(ErrorCodeOK)
117 }
118 err := data.options.NotifyCallback(CheckoutNotifyType(why), path, baseline, target, workdir)
119 if err != nil {
120 *data.errorTarget = err
121 return C.int(ErrorCodeUser)
122 }
123 return C.int(ErrorCodeOK)
124}
125
126//export checkoutProgressCallback
127func checkoutProgressCallback(

Callers

nothing calls this directly

Calls 3

diffFileFromCFunction · 0.85
CheckoutNotifyTypeTypeAlias · 0.85
GetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…