patchApply is go-diff's PatchApply with its panic returned as an error.
(patches []difflib.Patch, base string)
| 90 | |
| 91 | // patchApply is go-diff's PatchApply with its panic returned as an error. |
| 92 | func patchApply(patches []difflib.Patch, base string) (result string, applied []bool, err error) { |
| 93 | defer func() { |
| 94 | if r := recover(); r != nil { |
| 95 | result, applied, err = "", nil, fmt.Errorf("go-diff panicked applying the patch: %v", r) |
| 96 | } |
| 97 | }() |
| 98 | result, applied = dmp.PatchApply(patches, base) |
| 99 | return result, applied, nil |
| 100 | } |
| 101 | |
| 102 | // IsDiffSmaller returns true if storing a diff would be meaningfully smaller |
| 103 | // than storing the full content. Returns false for near-complete rewrites |