apply runs gitdiff.Apply, wrapping any conflicts in patch2pr's Conflict type.
(dst io.Writer, src io.ReaderAt, name string, f *gitdiff.File)
| 362 | |
| 363 | // apply runs gitdiff.Apply, wrapping any conflicts in patch2pr's Conflict type. |
| 364 | func 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? |
| 382 | func getMode(f *gitdiff.File, existing *github.TreeEntry) string { |
no test coverage detected