Add DiffTreeToWorkdirWithIndex
This commit is contained in:
parent
43102043fb
commit
8622831b11
25
diff.go
25
diff.go
|
@ -595,3 +595,28 @@ func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff,
|
|||
}
|
||||
return newDiffFromC(diffPtr), nil
|
||||
}
|
||||
|
||||
func (v *Repository) DiffTreeToWorkdirWithIndex(oldTree *Tree, opts *DiffOptions) (*Diff, error) {
|
||||
var diffPtr *C.git_diff
|
||||
var oldPtr *C.git_tree
|
||||
|
||||
if oldTree != nil {
|
||||
oldPtr = oldTree.cast_ptr
|
||||
}
|
||||
|
||||
copts, notifyData := diffOptionsToC(opts)
|
||||
defer freeDiffOptions(copts)
|
||||
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ecode := C.git_diff_tree_to_workdir_with_index(&diffPtr, v.ptr, oldPtr, copts)
|
||||
if ecode < 0 {
|
||||
return nil, MakeGitError(ecode)
|
||||
}
|
||||
|
||||
if notifyData != nil && notifyData.Diff != nil {
|
||||
return notifyData.Diff, nil
|
||||
}
|
||||
return newDiffFromC(diffPtr), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue