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

Method DiffIndexToWorkdir

diff.go:807–832  ·  view source on GitHub ↗
(index *Index, opts *DiffOptions)

Source from the content-addressed store, hash-verified

805}
806
807func (v *Repository) DiffIndexToWorkdir(index *Index, opts *DiffOptions) (*Diff, error) {
808 var diffPtr *C.git_diff
809 var indexPtr *C.git_index
810
811 if index != nil {
812 indexPtr = index.ptr
813 }
814
815 var err error
816 copts := populateDiffOptions(&C.git_diff_options{}, opts, v, &err)
817 defer freeDiffOptions(copts)
818
819 runtime.LockOSThread()
820 defer runtime.UnlockOSThread()
821
822 ret := C.git_diff_index_to_workdir(&diffPtr, v.ptr, indexPtr, copts)
823 runtime.KeepAlive(index)
824 if ret == C.int(ErrorCodeUser) && err != nil {
825 return nil, err
826 }
827 if ret < 0 {
828 return nil, MakeGitError(ret)
829 }
830
831 return newDiffFromC(diffPtr, v), nil
832}
833
834// DiffBlobs performs a diff between two arbitrary blobs. You can pass
835// whatever file names you'd like for them to appear as in the diff.

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected