diff options
| author | Mark Probst <[email protected]> | 2015-03-11 16:12:39 -0700 |
|---|---|---|
| committer | Mark Probst <[email protected]> | 2015-03-23 12:02:17 -0700 |
| commit | 524cc7967be53176108e5c703818ccdd18882100 (patch) | |
| tree | 0ffe6ae36bbcdca1cd57ec9a0d9fb8515547b600 /diff.go | |
| parent | 8622831b1128fee96da8a1829b948a49adc3dd6e (diff) | |
Add DiffIndexToWorkdir
Diffstat (limited to 'diff.go')
| -rw-r--r-- | diff.go | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -620,3 +620,28 @@ func (v *Repository) DiffTreeToWorkdirWithIndex(oldTree *Tree, opts *DiffOptions } return newDiffFromC(diffPtr), nil } + +func (v *Repository) DiffIndexToWorkdir(index *Index, opts *DiffOptions) (*Diff, error) { + var diffPtr *C.git_diff + var indexPtr *C.git_index + + if index != nil { + indexPtr = index.ptr + } + + copts, notifyData := diffOptionsToC(opts) + defer freeDiffOptions(copts) + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ecode := C.git_diff_index_to_workdir(&diffPtr, v.ptr, indexPtr, copts) + if ecode < 0 { + return nil, MakeGitError(ecode) + } + + if notifyData != nil && notifyData.Diff != nil { + return notifyData.Diff, nil + } + return newDiffFromC(diffPtr), nil +} |
