Documentation
¶
Overview ¶
Package worktree manages native-Git effort worktrees.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(roots awfgit.ControlRoots, open OpenCheckout, openResident OpenResident) (*Manager, error)
Open composes managed-worktree mechanics over resolved control roots and explicit Git and resident capabilities. Effort lifecycle coordination belongs to the application boundary above this manager.
type OpenCheckout ¶
OpenCheckout opens the Git surface of the checkout rooted at root. The manager reasons about two checkouts at once - the one it was invoked from and the managed one it is creating or retiring - so it opens each by root instead of holding a single handle.
type OpenResident ¶ added in v0.41.0
type OpenResident func(root awfgit.ResidentName) (ResidentHandle, error)
OpenResident provides the selected resident-root filesystem capability.
type RefusalError ¶
type RefusalError struct {
Category string
Condition string
ChangedTopology bool // legacy summary; Topology carries exact axes.
Topology TopologyEffects
ManagedPath string
ManagedBranch string
NextAction string
NextActions []string
Err error
}
func (*RefusalError) Error ¶
func (e *RefusalError) Error() string
func (*RefusalError) Unwrap ¶
func (e *RefusalError) Unwrap() error
type ResidentHandle ¶ added in v0.41.0
type ResidentHandle interface {
Close() error
MkdirAll(string, fs.FileMode) error
LinkInfo(string) (fs.FileInfo, error)
}
ResidentHandle is the confined resident-root capability the manager needs.
type Result ¶
type Result struct {
Condition string
ChangedTopology bool // legacy summary; Topology contains exact axes.
Topology TopologyEffects
NextAction string
Path string
Branch string
}
Result carries structured managed-topology facts for orchestration and presentation mapping.
type Runner ¶
type Runner interface {
WorktreeList(ctx context.Context) ([]awfgit.WorktreeRegistration, error)
WorktreeAdd(ctx context.Context, path, branch, base string) error
WorktreeRemove(ctx context.Context, path string) error
WorktreePrune(ctx context.Context) error
BranchExists(ctx context.Context, name string) (bool, error)
BranchDelete(ctx context.Context, name string) error
Ancestor(ctx context.Context, older, newer string) (bool, error)
MergeBase(ctx context.Context, a, b string) (string, error)
MergeFastForward(ctx context.Context, rev string) error
MergeNoCommit(ctx context.Context, rev string) error
ResolveCommit(ctx context.Context, revision string) (string, error)
CurrentBranch(ctx context.Context) (string, error)
ChangeCounts(ctx context.Context) (tracked, untracked int, err error)
IgnoredPaths(ctx context.Context) ([]string, error)
GitPath(ctx context.Context, name string) (string, error)
}
Runner is this package's own contract on one checkout's Git surface. It names exactly the operations the manager performs and nothing more, so the manager depends on what it uses rather than on a repository object; the composition root satisfies it with the Git seam's handle.
type TopologyEffects ¶ added in v0.41.0
type TopologyEffects struct {
ManagedPath bool
GitRegistration bool
Branch bool
ReceivingHEAD bool
}
TopologyEffects records independently completed Git topology changes.
func (TopologyEffects) Changed ¶ added in v0.41.0
func (e TopologyEffects) Changed() bool