Documentation
¶
Overview ¶
Package gitwt reads worktree information from Git itself. It never creates, moves or removes worktrees — that is the job of Git or Worktrunk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotRepo = errors.New("not inside a git worktree")
Functions ¶
func AdminIDFromGitDir ¶
AdminIDFromGitDir maps a worktree's git dir to its admin id.
Types ¶
type Repo ¶
type Repo struct {
CommonDir string // absolute git common dir (shared by all worktrees)
MainPath string // main worktree path ("" for bare repositories)
TopLevel string // top level of the worktree that contained the query path
CurrentAdmin string // admin id of that worktree
}
Repo describes the repository a path belongs to.
type Worktree ¶
type Worktree struct {
Path string // absolute, symlinks resolved
Head string
Branch string // short name, "" when detached
Detached bool
Bare bool
Locked bool
Prunable bool
IsMain bool
// AdminID is the name of the directory under <common-dir>/worktrees that
// Git uses for this worktree. It survives `git worktree move`. It is "."
// for the main worktree.
AdminID string
}
Worktree is one entry of `git worktree list --porcelain`, enriched with the stable admin-dir identity.
func ParsePorcelain ¶
ParsePorcelain parses `git worktree list --porcelain` output. The first entry is always the main worktree.