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

Method DiffTreeToWorkdir

diff.go:720–745  ·  view source on GitHub ↗
(oldTree *Tree, opts *DiffOptions)

Source from the content-addressed store, hash-verified

718}
719
720func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff, error) {
721 var diffPtr *C.git_diff
722 var oldPtr *C.git_tree
723
724 if oldTree != nil {
725 oldPtr = oldTree.cast_ptr
726 }
727
728 var err error
729 copts := populateDiffOptions(&C.git_diff_options{}, opts, v, &err)
730 defer freeDiffOptions(copts)
731
732 runtime.LockOSThread()
733 defer runtime.UnlockOSThread()
734
735 ret := C.git_diff_tree_to_workdir(&diffPtr, v.ptr, oldPtr, copts)
736 runtime.KeepAlive(oldTree)
737 if ret == C.int(ErrorCodeUser) && err != nil {
738 return nil, err
739 }
740 if ret < 0 {
741 return nil, MakeGitError(ret)
742 }
743
744 return newDiffFromC(diffPtr, v), nil
745}
746
747func (v *Repository) DiffTreeToIndex(oldTree *Tree, index *Index, opts *DiffOptions) (*Diff, error) {
748 var diffPtr *C.git_diff

Callers

nothing calls this directly

Calls 4

populateDiffOptionsFunction · 0.85
freeDiffOptionsFunction · 0.85
MakeGitErrorFunction · 0.85
newDiffFromCFunction · 0.85

Tested by

no test coverage detected