gitdiff

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffLines

func DiffLines(diff []diffmatchpatch.Diff) (ret []diffmatchpatch.Diff)

CombineIntoLines traverse through diff and creates separate per line diff for each prefix and suffix diff chunks. NOTE: This is useful to normalize output to git diff.

func PrintDMPDiff

func PrintDMPDiff(diff []diffmatchpatch.Diff, contextLines int) []byte

PrintDMPDiff prints diffmatchpatch.Diff slice in git combined diff format, specified in https://git-scm.com/docs/diff-format#_combined_diff_format. It's caller responsibility to add extended header lines and git diff header if needed.

Types

type Diff

type Diff struct {
	// contains filtered or unexported fields
}

func Compare

func Compare(a, aFn, b, bFn string) Diff

func CompareBytes

func CompareBytes(a []byte, aFn string, b []byte, bFn string) Diff

func (Diff) ToCombinedFormat

func (d Diff) ToCombinedFormat() []byte

ToCombinedFormat prints diff in git combined diff format, specified in https://git-scm.com/docs/diff-format#_combined_diff_format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL