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

Method DiffTreeToTree

diff.go:689–718  ·  view source on GitHub ↗
(oldTree, newTree *Tree, opts *DiffOptions)

Source from the content-addressed store, hash-verified

687}
688
689func (v *Repository) DiffTreeToTree(oldTree, newTree *Tree, opts *DiffOptions) (*Diff, error) {
690 var diffPtr *C.git_diff
691 var oldPtr, newPtr *C.git_tree
692
693 if oldTree != nil {
694 oldPtr = oldTree.cast_ptr
695 }
696
697 if newTree != nil {
698 newPtr = newTree.cast_ptr
699 }
700
701 var err error
702 copts := populateDiffOptions(&C.git_diff_options{}, opts, v, &err)
703 defer freeDiffOptions(copts)
704
705 runtime.LockOSThread()
706 defer runtime.UnlockOSThread()
707
708 ret := C.git_diff_tree_to_tree(&diffPtr, v.ptr, oldPtr, newPtr, copts)
709 runtime.KeepAlive(oldTree)
710 runtime.KeepAlive(newTree)
711 if ret == C.int(ErrorCodeUser) && err != nil {
712 return nil, err
713 }
714 if ret < 0 {
715 return nil, MakeGitError(ret)
716 }
717 return newDiffFromC(diffPtr, v), nil
718}
719
720func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff, error) {
721 var diffPtr *C.git_diff

Callers 5

TestPatchFunction · 0.80
TestFindSimilarFunction · 0.80
TestDiffTreeToTreeFunction · 0.80
TestApplyDiffAddfileFunction · 0.80
TestApplyToTreeFunction · 0.80

Calls 4

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

Tested by 5

TestPatchFunction · 0.64
TestFindSimilarFunction · 0.64
TestDiffTreeToTreeFunction · 0.64
TestApplyDiffAddfileFunction · 0.64
TestApplyToTreeFunction · 0.64