summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Probst <[email protected]>2015-03-11 16:12:22 -0700
committerMark Probst <[email protected]>2015-03-23 12:02:17 -0700
commit8622831b1128fee96da8a1829b948a49adc3dd6e (patch)
tree36f1d0eaaa0c9e5ce84218ef7c41a10346ca214d
parent43102043fb5311939e9ec50f7210ffb51183684a (diff)
Add DiffTreeToWorkdirWithIndex
-rw-r--r--diff.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/diff.go b/diff.go
index 63fa867..54e4a92 100644
--- a/diff.go
+++ b/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
+}