Help us shape the future of Go! Take the 2026 Go Developer Survey

worktree

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Busy

func Busy(ops git.Ops) (bool, error)

Busy includes clean but unfinished merge/sequencer operations, which a porcelain cleanliness check alone would miss.

func CheckClean

func CheckClean(ops git.Ops, path string) error

func SamePath

func SamePath(a, b string) bool

Types

type Context

type Context struct {
	Origin        Location             `json:"origin"`
	Owners        map[string]*Location `json:"owners,omitempty"`
	Touched       map[string]string    `json:"touched,omitempty"`
	Pending       string               `json:"pending,omitempty"`
	PendingBefore string               `json:"pendingBefore,omitempty"`
}

Context binds a multi-branch operation to its original worktrees. Touched records the last ref value written by the operation, not merely a snapshot: recovery must not overwrite commits made after the operation stopped.

func New

func New() (*Context, error)

func (*Context) Location

func (c *Context) Location(branch string) *Location

func (*Context) Ops

func (c *Context) Ops(branch string) (git.Ops, error)

func (*Context) OriginOps

func (c *Context) OriginOps() (git.Ops, error)

func (*Context) Preflight

func (c *Context) Preflight(branches []string) error

func (*Context) Prepare

func (c *Context) Prepare(branch string) (git.Ops, error)

Prepare may switch the initiating worktree, but never a different worktree.

func (*Context) Record

func (c *Context) Record(branch string) error

func (*Context) Rename

func (c *Context) Rename(oldName, newName string)

func (*Context) Restore

func (c *Context) Restore(originalRefs map[string]string) error

func (*Context) RestoreOrigin

func (c *Context) RestoreOrigin(branch string) error

func (*Context) Start

func (c *Context) Start(branch string, expected ...string) error

type Location

type Location struct {
	Path string `json:"path"`
	ID   string `json:"id,omitempty"`
}

Location records a worktree's stable administration-directory identity. Path is refreshed from Git if the worktree has moved.

Jump to

Keyboard shortcuts

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