Documentation
¶
Overview ¶
Package repo resolves a filesystem path to its canonical parent git repository. It reads .git purely in Go — it never shells out to git and never forks a process — so it is safe on the tracker's render/rescan path.
Linked worktrees fold onto their main repository: every worktree of a repo shares one stable identity (the resolved common git dir), so they group together. The package has no dependency on the TUI or picker, so a later machine-wide repo-discovery feature can reuse it unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache memoizes Resolve per absolute path. A session's cwd does not change repos within a run, so the tracker keeps one Cache across refresh ticks and avoids re-reading .git on every rescan. It is safe for concurrent use.
type Repo ¶
type Repo struct {
// Identity is the canonical common git dir, symlink-resolved and cleaned.
// All worktrees of the same repository share it, so it is the grouping key.
Identity string
// Root is the main worktree root (the repo's top-level working directory).
Root string
// Name is the display name: the base name of Root.
Name string
}
Repo is a resolved git repository.
func Resolve ¶
Resolve walks up from path looking for a .git entry and returns the canonical parent repository. A .git directory is a normal checkout; a .git file points at a linked worktree, which is folded onto its main repo via the worktree's commondir. ok is false for a path outside any git repo or for any read error (the caller treats that as "not a repo" / ungrouped).