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