go-git.v4: gopkg.in/src-d/go-git.v4/utils/diff Index | Files

package diff

import "gopkg.in/src-d/go-git.v4/utils/diff"

Package diff implements line oriented diffs, similar to the ancient Unix diff command.

The current implementation is just a wrapper around Sergi's go-diff/diffmatchpatch library, which is a go port of Neil Fraser's google-diff-match-patch code

Index

Package Files

diff.go

func Do Uses

func Do(src, dst string) (diffs []diffmatchpatch.Diff)

Do computes the (line oriented) modifications needed to turn the src string into the dst string. The underlying algorithm is Meyers, its complexity is O(N*d) where N is min(lines(src), lines(dst)) and d is the size of the diff.

func DoWithTimeout Uses

func DoWithTimeout(src, dst string, timeout time.Duration) (diffs []diffmatchpatch.Diff)

DoWithTimeout computes the (line oriented) modifications needed to turn the src string into the dst string. The `timeout` argument specifies the maximum amount of time it is allowed to spend in this function. If the timeout is exceeded, the parts of the strings which were not considered are turned into a bulk delete+insert and the half-baked suboptimal result is returned at once. The underlying algorithm is Meyers, its complexity is O(N*d) where N is min(lines(src), lines(dst)) and d is the size of the diff.

func Dst Uses

func Dst(diffs []diffmatchpatch.Diff) string

Dst computes and returns the destination text.

func Src Uses

func Src(diffs []diffmatchpatch.Diff) string

Src computes and returns the source text

Package diff imports 3 packages (graph) and is imported by 5 packages. Updated 2019-08-02. Refresh now. Tools for package owners.