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

Function patchApply

internal/diff/diff.go:92–100  ·  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

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

Callers 1

ApplyPatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected