gitdiff

package
v0.9.44 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package gitdiff exposes structured staged and working-tree changes for the web Changes panel.

Index

Constants

This section is empty.

Variables

View Source
var ErrPathOutsideRepository = errors.New("file path is outside repository")

ErrPathOutsideRepository means a requested file is not contained by the repository and must never be read as diff content.

Functions

This section is empty.

Types

type Repo

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

Repo is a Git checkout used for scoped diff queries.

func Open

func Open(ctx context.Context, dir string) (*Repo, error)

Open discovers the checkout containing dir.

func (*Repo) File

func (r *Repo) File(ctx context.Context, scope Scope, path string) (*filetrack.FileDiffContent, error)

File returns retained text for one changed path, or nil when the path is not changed in scope. Binary and oversized files are returned as truncated.

func (*Repo) List

func (r *Repo) List(ctx context.Context, scope Scope) ([]filetrack.CumulativeChange, error)

List returns per-file metadata for scope.

type Scope

type Scope string

Scope selects which Git states are compared.

const (
	ScopeUncommitted Scope = "uncommitted"
	ScopeUnstaged    Scope = "unstaged"
	ScopeStaged      Scope = "staged"
)

Jump to

Keyboard shortcuts

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