MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / patchApply

Function patchApply

internal/diff/diff.go:93–101  ·  view source on GitHub ↗

patchApply is go-diff's PatchApply with its panic returned as an error.

(patches []difflib.Patch, base string)

Source from the content-addressed store, hash-verified

91
92// patchApply is go-diff's PatchApply with its panic returned as an error.
93func 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

Callers 1

ApplyPatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected