(copts *C.git_diff_options, opts *DiffOptions, repo *Repository, errorTarget *error)
| 644 | } |
| 645 | |
| 646 | func populateDiffOptions(copts *C.git_diff_options, opts *DiffOptions, repo *Repository, errorTarget *error) *C.git_diff_options { |
| 647 | C.git_diff_options_init(copts, C.GIT_DIFF_OPTIONS_VERSION) |
| 648 | if opts == nil { |
| 649 | return nil |
| 650 | } |
| 651 | |
| 652 | copts.flags = C.uint32_t(opts.Flags) |
| 653 | copts.ignore_submodules = C.git_submodule_ignore_t(opts.IgnoreSubmodules) |
| 654 | if len(opts.Pathspec) > 0 { |
| 655 | copts.pathspec.count = C.size_t(len(opts.Pathspec)) |
| 656 | copts.pathspec.strings = makeCStringsFromStrings(opts.Pathspec) |
| 657 | } |
| 658 | copts.context_lines = C.uint32_t(opts.ContextLines) |
| 659 | copts.interhunk_lines = C.uint32_t(opts.InterhunkLines) |
| 660 | copts.id_abbrev = C.uint16_t(opts.IdAbbrev) |
| 661 | copts.max_size = C.git_off_t(opts.MaxSize) |
| 662 | copts.old_prefix = C.CString(opts.OldPrefix) |
| 663 | copts.new_prefix = C.CString(opts.NewPrefix) |
| 664 | |
| 665 | if opts.NotifyCallback != nil { |
| 666 | notifyData := &diffNotifyCallbackData{ |
| 667 | callback: opts.NotifyCallback, |
| 668 | repository: repo, |
| 669 | errorTarget: errorTarget, |
| 670 | } |
| 671 | C._go_git_setup_diff_notify_callbacks(copts) |
| 672 | copts.payload = pointerHandles.Track(notifyData) |
| 673 | } |
| 674 | return copts |
| 675 | } |
| 676 | |
| 677 | func freeDiffOptions(copts *C.git_diff_options) { |
| 678 | if copts == nil { |
no test coverage detected
searching dependent graphs…