changes

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileLimit  = 3000
	PatchLimit = 1 << 20
)

Variables

View Source
var (
	ErrNotARepository   = errors.New("changes: not a git repository")
	ErrBaseNotFound     = errors.New("changes: base ref not found")
	ErrStale            = errors.New("changes: working tree changed since revision")
	ErrTooLargeToExpand = errors.New("changes: file too large to expand")
	ErrInvalidScope     = errors.New("changes: invalid scope")
	ErrTooManyPaths     = errors.New("changes: patch batch exceeds limits")
	ErrUnavailable      = errors.New("changes: git read failed")
)

Functions

func LogFailure

func LogFailure(ctx context.Context, logger *slog.Logger, root string, err error)

LogFailure records classified failures without exposing host paths.

Types

type BaseList

type BaseList struct {
	Default    *BaseRef
	Resolvable bool
	Refs       []BaseRef
	Truncated  bool
}

type BaseRef

type BaseRef struct {
	Ref, Kind string
	IsDefault bool
	Source    BaseSource
}

type BaseSource

type BaseSource string

type Contents

type Contents struct {
	Path, Fingerprint, OldPath string
	Old, New                   *Side
}

type FileChange

type FileChange struct {
	Path, OldPath                string
	Status                       Status
	Additions, Deletions         int
	Binary, Generated, Sensitive bool
	Fingerprint                  string
	// contains filtered or unexported fields
}

type GitEngine

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

func NewEngine

func NewEngine(opts ...Option) *GitEngine

func (*GitEngine) Bases

func (e *GitEngine) Bases(ctx context.Context, root projectfiles.Root, q string, limit int) (BaseList, error)

func (*GitEngine) Contents

func (e *GitEngine) Contents(
	ctx context.Context,
	root projectfiles.Root,
	req Request,
	t PatchTarget,
) (Contents, error)

func (*GitEngine) Patches

func (e *GitEngine) Patches(
	ctx context.Context,
	root projectfiles.Root,
	req Request,
	targets []PatchTarget,
) ([]Patch, error)

func (*GitEngine) Summary

func (e *GitEngine) Summary(ctx context.Context, root projectfiles.Root, req Request) (Summary, error)

type Option

type Option func(*GitEngine)

func WithGitRunner

func WithGitRunner(runner worktree.StreamingGitRunner) Option

func WithReader

func WithReader(reader projectfiles.Reader) Option

type Patch

type Patch struct {
	Path, Patch         string
	TooLarge, Sensitive bool
	Fingerprint         string
}

type PatchTarget

type PatchTarget struct{ Path, OldPath string }

type Request

type Request struct {
	Scope             Scope
	BaseRef, Revision string
	Reveal            bool
}

type Scope

type Scope string
const (
	Branch      Scope = "branch"
	Uncommitted Scope = "uncommitted"
)

type Side

type Side struct {
	Text      string
	Sensitive bool
}

type Status

type Status string
const Conflicted Status = "conflicted"

type Summary

type Summary struct {
	Scope                        Scope
	HeadBranch, HeadSHA, BaseRef string
	BaseSource                   BaseSource
	MergeBaseSHA                 string
	Files                        []FileChange
	Totals                       Totals
	Truncated                    bool
	Revision                     string
}

type Totals

type Totals struct {
	Files, Additions, Deletions int
	Partial                     bool
}

Jump to

Keyboard shortcuts

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