MCPcopy Create free account
hub / github.com/bluekeyes/patch2pr / apply

Function apply

applier.go:364–379  ·  view source on GitHub ↗

apply runs gitdiff.Apply, wrapping any conflicts in patch2pr's Conflict type.

(dst io.Writer, src io.ReaderAt, name string, f *gitdiff.File)

Source from the content-addressed store, hash-verified

362
363// apply runs gitdiff.Apply, wrapping any conflicts in patch2pr's Conflict type.
364func apply(dst io.Writer, src io.ReaderAt, name string, f *gitdiff.File) error {
365 if err := gitdiff.Apply(dst, src, f); err != nil {
366 var applyErr *gitdiff.ApplyError
367 var conflict *gitdiff.Conflict
368 if errors.As(err, &applyErr) && errors.As(err, &conflict) {
369 return &Conflict{
370 Type: ConflictContent,
371 File: name,
372 Line: applyErr.Line,
373 cause: conflict,
374 }
375 }
376 return err
377 }
378 return nil
379}
380
381// TODO(bkeyes): extract this to go-gitdiff in some form?
382func getMode(f *gitdiff.File, existing *github.TreeEntry) string {

Callers 5

applyDeleteMethod · 0.85
base64ApplyFunction · 0.85
applyCreateMethod · 0.85
applyDeleteMethod · 0.85
applyModifyMethod · 0.85

Calls 1

ApplyMethod · 0.45

Tested by

no test coverage detected