gitdiff

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSagaPath

func IsSagaPath(path string) bool

func Key

func Key(atom Atom) string

func VerifyRepository

func VerifyRepository(ctx context.Context, repo, declared string) error

VerifyRepository confirms the checkout identity when its file path or origin provides enough information to do so.

Types

type Atom

type Atom struct {
	Key     string `json:"key"`
	URI     string `json:"uri"`
	Kind    string `json:"kind"`
	Path    string `json:"path,omitempty"`
	Side    string `json:"side,omitempty"`
	Line    int    `json:"line,omitempty"`
	Content string `json:"content,omitempty"`
	Event   string `json:"event,omitempty"`
	OldPath string `json:"old_path,omitempty"`
	NewPath string `json:"new_path,omitempty"`
}

func Parse

func Parse(patch []byte) ([]Atom, error)

type ChangeSet

type ChangeSet struct {
	Repository  string `json:"repository"`
	Base        string `json:"base"`
	Head        string `json:"head"`
	BaseOID     string `json:"base_oid"`
	HeadOID     string `json:"head_oid"`
	Atoms       []Atom `json:"atoms"`
	SagaChanges []Atom `json:"saga_changes"`
	// DisplayLines contains bounded unchanged context alongside changed atoms.
	// It is renderer-only: coverage and persisted diff identity continue to use
	// Atoms exclusively.
	DisplayLines []DisplayLine `json:"-"`
}

func Read

func Read(ctx context.Context, fromDir, repositoryURI, base, head string) (ChangeSet, error)

func ReadWithOptions

func ReadWithOptions(ctx context.Context, fromDir, repositoryURI, base, head string, options ReadOptions) (ChangeSet, error)

type DisplayLine

type DisplayLine struct {
	Kind    string
	Path    string
	OldLine int
	NewLine int
	Content string
	AtomKey string
	Event   string
	OldPath string
	NewPath string
}

type ReadOptions

type ReadOptions struct {
	AllowRepositoryMismatch bool
}

Jump to

Keyboard shortcuts

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