diff options
| author | Mark Probst <[email protected]> | 2015-03-11 16:12:22 -0700 |
|---|---|---|
| committer | Mark Probst <[email protected]> | 2015-03-23 12:02:17 -0700 |
| commit | 8622831b1128fee96da8a1829b948a49adc3dd6e (patch) | |
| tree | 36f1d0eaaa0c9e5ce84218ef7c41a10346ca214d | |
| parent | 43102043fb5311939e9ec50f7210ffb51183684a (diff) | |
Add DiffTreeToWorkdirWithIndex
| -rw-r--r-- | diff.go | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 +} |
