Documentation
¶
Overview ¶
Package worktree manages Git worktrees and Jujutsu workspaces for XenForo development environments.
Index ¶
- func AdoptWorktree(ctx context.Context, path string, opts AdoptOptions) error
- func CompletionRefs(cmd *cobra.Command, args []string, _ string) ([]cobra.Completion, cobra.ShellCompDirective)
- func CreateWorktree(ctx context.Context, args []string, opts CreateOptions) error
- func List(ctx context.Context, json bool) error
- func ListAll(json bool) error
- func Path(ctx context.Context, name string) error
- func Prune() error
- func RemoveWorktree(ctx context.Context, name string, opts RemoveOptions) error
- type AdoptOptions
- type CreateOptions
- type RemoveOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdoptWorktree ¶ added in v0.5.1
func AdoptWorktree(ctx context.Context, path string, opts AdoptOptions) error
AdoptWorktree registers the linked checkout containing path without modifying it. It warns when the checkout shares the source's instance, because removal would refuse to tear that environment down.
func CompletionRefs ¶
func CompletionRefs(cmd *cobra.Command, args []string, _ string) ([]cobra.Completion, cobra.ShellCompDirective)
CompletionRefs lists the branches and directory names of this project's worktrees, both of which worktree references accept. Entries are checked against the filesystem because a worktree can be deleted without telling the registry.
func CreateWorktree ¶
func CreateWorktree(ctx context.Context, args []string, opts CreateOptions) error
CreateWorktree reserves a name, creates a checkout, and optionally sets up or clones its environment. JSON requires no setup so stdout remains a single document; this is validated before mutation. A failed creation releases its reservation only if no directory remains, protecting its instance name. Registry update failures after creation are warnings, not creation failures. Cloning skips installation to protect imported data and requires containers; no-up skips cloning and warns when an installed source cannot be copied. Fresh-install credentials are not reported for a clone, which retains the source's logins. Setup or cloning errors leave the created worktree in place.
func Prune ¶
func Prune() error
Prune removes stale registry entries and reports the number removed.
func RemoveWorktree ¶
func RemoveWorktree(ctx context.Context, name string, opts RemoveOptions) error
RemoveWorktree removes a worktree and, unless kept, its containers and volumes. It first confirms that the target is a linked, non-source checkout of the repository, even when forced, and refuses to tear down an environment that shares the source's instance. Unless forced, it checks for work that would be lost before destroying the environment. Containers are removed before the checkout because Compose needs its files. Registry update failures are warnings.
Types ¶
type AdoptOptions ¶ added in v0.5.1
AdoptOptions controls the recorded instance and output format of an adopted worktree.
type CreateOptions ¶
type CreateOptions struct {
Base, AdminUser, AdminPassword, AdminEmail, Title, Instance string
NoSetup, NoUp, JSON, Fresh, SkipBuildJS bool
}
CreateOptions controls the base revision, environment setup, credentials, instance, output format, and cloning behavior of a new worktree.
type RemoveOptions ¶
RemoveOptions controls forced removal, container retention, and error detail.