Documentation
¶
Overview ¶
Package worktree provides worktree management operations.
Index ¶
- type Manager
- func (m *Manager) Create(name string, baseSnapshotID *model.SnapshotID) (*model.WorktreeConfig, error)
- func (m *Manager) CreateFromSnapshot(name string, snapshotID model.SnapshotID, ...) (*model.WorktreeConfig, error)
- func (m *Manager) CreateStartedFromSnapshot(name string, snapshotID model.SnapshotID, ...) (*model.WorktreeConfig, error)
- func (m *Manager) Fork(snapshotID model.SnapshotID, name string, ...) (*model.WorktreeConfig, error)
- func (m *Manager) Get(name string) (*model.WorktreeConfig, error)
- func (m *Manager) List() ([]*model.WorktreeConfig, error)
- func (m *Manager) Path(name string) (string, error)
- func (m *Manager) PlannedStartedFromPath(name string) (string, error)
- func (m *Manager) RebindRealPath(name, realPath string) error
- func (m *Manager) Remove(name string) error
- func (m *Manager) Rename(oldName, newName string) error
- func (m *Manager) SetLatest(name string, snapshotID model.SnapshotID) error
- func (m *Manager) UpdateHead(name string, snapshotID model.SnapshotID) error
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
}
Manager handles worktree CRUD operations.
func NewManager ¶
NewManager creates a new worktree manager.
func (*Manager) Create ¶
func (m *Manager) Create(name string, baseSnapshotID *model.SnapshotID) (*model.WorktreeConfig, error)
Create creates a new worktree with the given name.
func (*Manager) CreateFromSnapshot ¶
func (m *Manager) CreateFromSnapshot(name string, snapshotID model.SnapshotID, cloneFunc func(src, dst string) error) (*model.WorktreeConfig, error)
CreateFromSnapshot creates a new worktree with content cloned from a snapshot. This is similar to Fork but uses "create" semantics (for the --from flag).
func (*Manager) CreateStartedFromSnapshot ¶
func (m *Manager) CreateStartedFromSnapshot(name string, snapshotID model.SnapshotID, cloneFunc func(src, dst string) error) (*model.WorktreeConfig, error)
CreateStartedFromSnapshot creates a new workspace whose files come from a save point, without inheriting that save point as workspace history.
func (*Manager) Fork ¶
func (m *Manager) Fork(snapshotID model.SnapshotID, name string, cloneFunc func(src, dst string) error) (*model.WorktreeConfig, error)
Fork creates a new worktree from a snapshot with content cloned. The new worktree will be at HEAD state (can create snapshots immediately).
func (*Manager) Get ¶
func (m *Manager) Get(name string) (*model.WorktreeConfig, error)
Get returns the config for a specific worktree.
func (*Manager) List ¶
func (m *Manager) List() ([]*model.WorktreeConfig, error)
List returns all worktrees.
func (*Manager) PlannedStartedFromPath ¶
PlannedStartedFromPath returns the workspace folder that CreateStartedFromSnapshot would publish, without creating staging, payload, or metadata paths.
func (*Manager) RebindRealPath ¶
RebindRealPath updates the workspace's destination-local real path after the caller has determined that the new binding is safe.
func (*Manager) SetLatest ¶
func (m *Manager) SetLatest(name string, snapshotID model.SnapshotID) error
SetLatest updates both head and latest snapshot IDs for a worktree. This is used by snapshot creation to mark a new latest state.
func (*Manager) UpdateHead ¶
func (m *Manager) UpdateHead(name string, snapshotID model.SnapshotID) error
UpdateHead atomically updates the head snapshot ID for a worktree. This is used by restore to move to a different point in history.