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

Function deltaApplyCallback

diff.go:937–959  ·  view source on GitHub ↗

export deltaApplyCallback

(_delta *C.git_diff_delta, _payload unsafe.Pointer)

Source from the content-addressed store, hash-verified

935
936//export deltaApplyCallback
937func deltaApplyCallback(_delta *C.git_diff_delta, _payload unsafe.Pointer) C.int {
938 data, ok := pointerHandles.Get(_payload).(*applyCallbackData)
939 if !ok {
940 panic("invalid apply options payload")
941 }
942
943 if data.options.ApplyDeltaCallback == nil {
944 return C.int(ErrorCodeOK)
945 }
946
947 delta := diffDeltaFromC(_delta)
948
949 apply, err := data.options.ApplyDeltaCallback(&delta)
950 if err != nil {
951 *data.errorTarget = err
952 return C.int(ErrorCodeUser)
953 }
954
955 if !apply {
956 return 1
957 }
958 return C.int(ErrorCodeOK)
959}
960
961// DefaultApplyOptions returns default options for applying diffs or patches.
962func DefaultApplyOptions() (*ApplyOptions, error) {

Callers

nothing calls this directly

Calls 2

diffDeltaFromCFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…