Documentation
¶
Overview ¶
Package worktree provides utilities for executing operations in Git worktrees.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateSessionOptions ¶
type CreateSessionOptions struct {
// Ref is the git ref (branch, commit, tag) to checkout in the worktree.
// If empty, defaults to trunk.
Ref string
// NamePattern is the pattern for the worktree directory name.
// Uses Go's os.MkdirTemp pattern (e.g., "stackit-work-*").
NamePattern string
// PullTrunk determines whether to pull the latest trunk before returning.
// Only applicable when Ref is trunk or empty.
PullTrunk bool
}
CreateSessionOptions configures how a worktree session is created.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor creates and manages temporary worktrees for executing operations.
func NewExecutor ¶
NewExecutor creates a new worktree executor.
func (*Executor) CreateSession ¶
CreateSession creates a new worktree session. The caller is responsible for calling Close() on the returned session.
type Session ¶
type Session struct {
Path string // Path to the worktree directory
Engine engine.Engine // Engine initialized for the worktree
// contains filtered or unexported fields
}
Session represents an active worktree session that can be used to execute operations. The caller must call Close() when done to clean up the worktree.
func (*Session) Close ¶
func (s *Session) Close()
Close cleans up the worktree session. This should be called when done with the session.
func (*Session) GetCurrentRevision ¶
GetCurrentRevision returns the current commit SHA of the worktree.
func (*Session) ResetToRef ¶
ResetToRef resets the worktree to the specified ref.