diffcore

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHunkPatch

func BuildHunkPatch(parsed ParsedDiff, hunkIndex int) (string, error)

func BuildLineRangePatch

func BuildLineRangePatch(parsed ParsedDiff, startChanged, endChanged int) (string, error)

func BuildRawToDisplayMap

func BuildRawToDisplayMap(parsed ParsedDiff, displayToRaw []int) []int

func BuildSingleLinePatch

func BuildSingleLinePatch(parsed ParsedDiff, changedIndex int) (string, error)

func HasBinaryDiff added in v0.14.1

func HasBinaryDiff(parsed ParsedDiff) bool

Types

type ChangedLine

type ChangedLine struct {
	LineIndex int
	HunkIndex int
	Prefix    byte
	Text      string
	OldLine   int
	NewLine   int
}

type ParsedDiff

type ParsedDiff struct {
	FileHeader []string
	Lines      []string
	Hunks      []ParsedHunk
	Changed    []ChangedLine
}

func ParseUnifiedDiff

func ParseUnifiedDiff(raw string) ParsedDiff

type ParsedHunk

type ParsedHunk struct {
	Header            string
	StartLine         int
	EndLine           int
	OldStart          int
	OldCount          int
	NewStart          int
	NewCount          int
	ChangedLineOffset []int
}

Jump to

Keyboard shortcuts

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