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

Function populateDiffOptions

diff.go:646–675  ·  view source on GitHub ↗
(copts *C.git_diff_options, opts *DiffOptions, repo *Repository, errorTarget *error)

Source from the content-addressed store, hash-verified

644}
645
646func 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
677func freeDiffOptions(copts *C.git_diff_options) {
678 if copts == nil {

Callers 7

PatchFromBuffersMethod · 0.85
DiffTreeToTreeMethod · 0.85
DiffTreeToWorkdirMethod · 0.85
DiffTreeToIndexMethod · 0.85
DiffIndexToWorkdirMethod · 0.85
DiffBlobsFunction · 0.85

Calls 2

makeCStringsFromStringsFunction · 0.85
TrackMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…