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

Method FindSimilar

diff.go:195–220  ·  view source on GitHub ↗
(opts *DiffFindOptions)

Source from the content-addressed store, hash-verified

193}
194
195func (diff *Diff) FindSimilar(opts *DiffFindOptions) error {
196
197 var copts *C.git_diff_find_options
198 if opts != nil {
199 copts = &C.git_diff_find_options{
200 version: C.GIT_DIFF_FIND_OPTIONS_VERSION,
201 flags: C.uint32_t(opts.Flags),
202 rename_threshold: C.uint16_t(opts.RenameThreshold),
203 copy_threshold: C.uint16_t(opts.CopyThreshold),
204 rename_from_rewrite_threshold: C.uint16_t(opts.RenameFromRewriteThreshold),
205 break_rewrite_threshold: C.uint16_t(opts.BreakRewriteThreshold),
206 rename_limit: C.size_t(opts.RenameLimit),
207 }
208 }
209
210 runtime.LockOSThread()
211 defer runtime.UnlockOSThread()
212
213 ecode := C.git_diff_find_similar(diff.ptr, copts)
214 runtime.KeepAlive(diff)
215 if ecode < 0 {
216 return MakeGitError(ecode)
217 }
218
219 return nil
220}
221
222type DiffStats struct {
223 doNotCompare

Callers 1

TestFindSimilarFunction · 0.80

Calls 1

MakeGitErrorFunction · 0.85

Tested by 1

TestFindSimilarFunction · 0.64