MCPcopy Create free account
hub / github.com/antonmedv/gitmal / NewTextApplier

Function NewTextApplier

pkg/gitdiff/apply_text.go:26–39  ·  view source on GitHub ↗

NewTextApplier creates a TextApplier that reads data from src and writes modified data to dst. If src implements LineReaderAt, it is used directly.

(dst io.Writer, src io.ReaderAt)

Source from the content-addressed store, hash-verified

24// NewTextApplier creates a TextApplier that reads data from src and writes
25// modified data to dst. If src implements LineReaderAt, it is used directly.
26func NewTextApplier(dst io.Writer, src io.ReaderAt) *TextApplier {
27 a := TextApplier{
28 dst: dst,
29 src: src,
30 }
31
32 if lineSrc, ok := src.(LineReaderAt); ok {
33 a.lineSrc = lineSrc
34 } else {
35 a.lineSrc = &lineReaderAt{r: src}
36 }
37
38 return &a
39}
40
41// ApplyFragment applies the changes in the fragment f, writing unwritten data
42// before the start of the fragment and any changes from the fragment. If

Callers 2

TestApplyTextFragmentFunction · 0.85
ApplyFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestApplyTextFragmentFunction · 0.68