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

Function hunkApplyCallback

diff.go:912–934  ·  view source on GitHub ↗

export hunkApplyCallback

(_hunk *C.git_diff_hunk, _payload unsafe.Pointer)

Source from the content-addressed store, hash-verified

910
911//export hunkApplyCallback
912func hunkApplyCallback(_hunk *C.git_diff_hunk, _payload unsafe.Pointer) C.int {
913 data, ok := pointerHandles.Get(_payload).(*applyCallbackData)
914 if !ok {
915 panic("invalid apply options payload")
916 }
917
918 if data.options.ApplyHunkCallback == nil {
919 return C.int(ErrorCodeOK)
920 }
921
922 hunk := diffHunkFromC(_hunk)
923
924 apply, err := data.options.ApplyHunkCallback(&hunk)
925 if err != nil {
926 *data.errorTarget = err
927 return C.int(ErrorCodeUser)
928 }
929
930 if !apply {
931 return 1
932 }
933 return C.int(ErrorCodeOK)
934}
935
936//export deltaApplyCallback
937func deltaApplyCallback(_delta *C.git_diff_delta, _payload unsafe.Pointer) C.int {

Callers

nothing calls this directly

Calls 2

diffHunkFromCFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…