Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindTextFragmentOffsetsBytes ¶
func FindTextFragmentOffsetsBytes(fragments []*gitdiff.TextFragment, r io.ByteReader) ([]int64, error)
FindTextFragmentOffsetsBytes scans a file and searches for occurrences of diff fragments. If all of the fragments can be found in the file, a list of byte offsets is returned at which the fragments are present. These can then be provided to ReplaceTextFragments() to perform the actual substitution.
func ReplaceTextFragments ¶
func ReplaceTextFragments(dst ByteStringWriter, src io.Reader, fragments []*gitdiff.TextFragment, offsetsBytes []int64) error
ReplaceTextFragments performs substitutions on an input file, replacing the contents of fragments in a diff file with the parts that need to be added. The offsets at which substitutions need to be performed are provided in the form of a list that can be obtained by calling FindTextFragmentOffsetsBytes().
Types ¶
type ByteStringWriter ¶
type ByteStringWriter interface { io.Writer io.StringWriter }
Click to show internal directories.
Click to hide internal directories.