Documentation
¶
Overview ¶
Package workspace manages Git mirrors and detached worktrees used to inspect candidate contributions.
Paths are contained beneath one managed root, repository hooks and optional helpers are disabled, command output is bounded, and dirty worktrees require explicit force before removal. Creating a workspace invokes git but never executes repository-controlled code.
Index ¶
- Variables
- type Manager
- func (m *Manager) ChangedFilesByPath(ctx context.Context, path, baseSHA string) ([]string, error)
- func (m *Manager) CheckMerge(ctx context.Context, path, baseOID, headOID string) (MergeCheck, error)
- func (m *Manager) Clone(ctx context.Context, remote, name string) error
- func (m *Manager) Create(ctx context.Context, mirrorName, baseRef, candidateRef, name string) (*Workspace, error)
- func (m *Manager) Diff(ctx context.Context, name string) (string, error)
- func (m *Manager) DiffByPath(ctx context.Context, path, baseSHA string) (string, error)
- func (m *Manager) Fetch(ctx context.Context, name string) error
- func (m *Manager) Get(name string) (*Workspace, bool)
- func (m *Manager) HasUntrackedByPath(ctx context.Context, path string) (bool, error)
- func (m *Manager) List() []*Workspace
- func (m *Manager) MergeBase(ctx context.Context, name string) (string, error)
- func (m *Manager) Remove(ctx context.Context, path string, force bool) error
- func (m *Manager) Resolve(ctx context.Context, mirrorName, ref string) (string, error)
- func (m *Manager) Status(ctx context.Context, name string) (Status, error)
- func (m *Manager) StatusByPath(ctx context.Context, path string) (Status, error)
- type MergeCheck
- type Runner
- type Status
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var ( ErrExists = errors.New("workspace already exists") ErrNotFound = errors.New("workspace not found") ErrNotManaged = errors.New("path is not a managed workspace") ErrDirty = errors.New("dirty workspace cannot be removed without force") ErrMirrorExists = errors.New("mirror already exists") ErrMirrorNotFound = errors.New("mirror not found") ErrInvalidName = errors.New("invalid name") ErrInvalidRemote = errors.New("invalid remote") ErrRemoteMismatch = errors.New("existing mirror remote does not match requested remote") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages Git mirrors and detached worktrees under a single root.
func NewManager ¶
NewManager creates a manager. A nil runner uses the default git runner.
func (*Manager) ChangedFilesByPath ¶
ChangedFilesByPath returns raw Git paths changed from the supplied base. Git owns rename, deletion, and quoted-path handling; NUL delimiters preserve paths containing whitespace or other special characters.
func (*Manager) CheckMerge ¶ added in v0.5.0
func (m *Manager) CheckMerge(ctx context.Context, path, baseOID, headOID string) (MergeCheck, error)
CheckMerge compares already-fetched revisions without fetching or changing refs, the index, or a worktree.
func (*Manager) Create ¶
func (m *Manager) Create(ctx context.Context, mirrorName, baseRef, candidateRef, name string) (*Workspace, error)
Create creates a detached worktree from mirrorName at candidateRef against baseRef.
func (*Manager) Diff ¶
Diff returns the current worktree diff against its recorded base SHA, including staged and unstaged changes without invoking external diff tools.
func (*Manager) DiffByPath ¶
DiffByPath returns the diff for a workspace path against the supplied base SHA, including staged and unstaged changes.
func (*Manager) HasUntrackedByPath ¶
HasUntrackedByPath reports whether a managed workspace contains untracked, non-ignored files. Callers preparing a complete diff must handle these explicitly because git diff does not include them.
func (*Manager) MergeBase ¶
MergeBase recomputes the merge base for the workspace base and candidate.
func (*Manager) Remove ¶
Remove removes the worktree at path. It refuses paths outside the managed root, unrecorded paths, and dirty workspaces unless force is true.
type MergeCheck ¶ added in v0.5.0
MergeCheck is a non-mutating comparison of two already-fetched revisions.
type Runner ¶
Runner executes an external command.
func DefaultRunner ¶
func DefaultRunner() Runner
DefaultRunner returns a Runner backed by the local git executable.
type Workspace ¶
type Workspace struct {
Name string
InvestigationID string
RepoOwner string
RepoName string
Path string
Remote string
BaseSHA string
CandidateSHA string
MergeBase string
Dirty bool
CreatedAt time.Time
// contains filtered or unexported fields
}
Workspace is a product-owned record for a managed Git worktree.