worktree

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package worktree manages Git worktrees and Jujutsu workspaces for XenForo development environments.

Index

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 List

func List(ctx context.Context, json bool) error

List prints registered worktrees for the current source checkout.

func ListAll

func ListAll(json bool) error

ListAll prints registered worktrees across source checkouts.

func Path

func Path(ctx context.Context, name string) error

Path prints the named worktree's path without decoration for shell use.

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

type AdoptOptions struct {
	Instance string
	JSON     bool
}

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

type RemoveOptions struct {
	Force          bool
	KeepContainers bool
	Verbose        bool
}

RemoveOptions controls forced removal, container retention, and error detail.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL