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

Method Patch

diff.go:418–434  ·  view source on GitHub ↗
(deltaIndex int)

Source from the content-addressed store, hash-verified

416}
417
418func (diff *Diff) Patch(deltaIndex int) (*Patch, error) {
419 if diff.ptr == nil {
420 return nil, ErrInvalid
421 }
422 var patchPtr *C.git_patch
423
424 runtime.LockOSThread()
425 defer runtime.UnlockOSThread()
426
427 ecode := C.git_patch_from_diff(&patchPtr, diff.ptr, C.size_t(deltaIndex))
428 runtime.KeepAlive(diff)
429 if ecode < 0 {
430 return nil, MakeGitError(ecode)
431 }
432
433 return newPatchFromC(patchPtr), nil
434}
435
436type DiffFormat int
437

Callers 2

TestPatchFunction · 0.80
TestDiffTreeToTreeFunction · 0.80

Calls 2

MakeGitErrorFunction · 0.85
newPatchFromCFunction · 0.85

Tested by 2

TestPatchFunction · 0.64
TestDiffTreeToTreeFunction · 0.64