git

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package git attributes workspace changes relative to an in-memory-owned baseline using fixed read-only Git commands.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotRepository means the workspace is not inside a Git work tree.
	ErrNotRepository = errors.New("coding git changes: workspace is not a repository")
	// ErrSnapshotExpired means a snapshot is stale, consumed, foreign, or forged.
	ErrSnapshotExpired = errors.New("coding git changes: snapshot expired")
	// ErrLimit means a bounded scan, copy, command, or diff budget was exceeded.
	ErrLimit = errors.New("coding git changes: resource limit exceeded")
	// ErrGit means a fixed read-only Git command failed.
	ErrGit = errors.New("coding git changes: git command failed")
	// ErrClosed means an Inspector was used after Close.
	ErrClosed = errors.New("coding git changes: inspector closed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	GitPath  string
	TempRoot string
	Limits   Limits
}

Config identifies the fixed Git executable and Inspector-owned temp root.

type Inspector

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

Inspector owns single-use content baselines for one Workspace.

func New

func New(
	ws workspace.Workspace,
	tree *workspace.Tree,
	policy execution.Policy,
	executor *execution.Executor,
	config Config,
) (*Inspector, error)

New constructs a read-only Git change Inspector.

func (*Inspector) Capture

func (i *Inspector) Capture(ctx context.Context) (changes.Snapshot, error)

Capture records the current tracked and non-ignored worktree content.

func (*Inspector) Changes

func (i *Inspector) Changes(
	ctx context.Context,
	snapshot changes.Snapshot,
) (_ changes.Report, returnErr error)

Changes consumes a Snapshot and reports worktree changes since Capture.

func (*Inspector) Close

func (i *Inspector) Close() error

Close removes every unconsumed baseline and closes the owned temp handle.

func (*Inspector) ExcludeLocal

func (i *Inspector) ExcludeLocal(ctx context.Context, name string) error

ExcludeLocal adds an anchored path to the repository's local info/exclude. It never modifies the shared .gitignore file.

func (*Inspector) ListWorkspaceFiles

func (i *Inspector) ListWorkspaceFiles(ctx context.Context) ([]string, bool, error)

ListWorkspaceFiles returns tracked and non-ignored untracked repository paths in stable order. repository is false only outside a Git worktree.

func (*Inspector) Status

Status returns current repository truth without consuming an interaction baseline or mutating Git state.

func (*Inspector) Tracked

func (i *Inspector) Tracked(ctx context.Context, name string) (bool, bool, error)

Tracked reports whether name is tracked and whether the Workspace is a Git repository. It is the narrow guard used for machine-local project files.

type Limits

type Limits struct {
	Files         int
	HashBytes     int64
	CopyBytes     int64
	DiffFileBytes int64
	GitBytes      int64
	DiffBytes     int64
	GitTimeout    time.Duration
	InspectTime   time.Duration
}

Limits bounds repository discovery, hashing, baseline copies, and output.

func DefaultLimits

func DefaultLimits() Limits

DefaultLimits returns conservative P0 Git inspection budgets.

Jump to

Keyboard shortcuts

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