(deltaIndex int)
| 416 | } |
| 417 | |
| 418 | func (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 | |
| 436 | type DiffFormat int |
| 437 |