Documentation
¶
Overview ¶
Package checkout gets the repository under review onto disk. Three modes (managed cache clone, user-supplied path, structured git root) all converge on one invariant: the review runs in a detached git worktree at the MR head SHA, never in a user's working tree.
Index ¶
Constants ¶
const AskpassTokenEnv = "GITLAB_REVIEWER_ASKPASS_TOKEN" //nolint:gosec // env var name, not a credential
AskpassTokenEnv carries the GitLab token to the inline git credential helper, scoped to git subprocesses only.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkout ¶
type Checkout struct {
// Path of the detached worktree at the MR head SHA.
Path string
// contains filtered or unexported fields
}
Checkout is a ready review worktree. Close removes it (unless the user asked to keep worktrees).
type CleanResult ¶
CleanResult reports what CleanCache removed.
func CleanCache ¶
CleanCache removes review worktrees and, when the clone cache exceeds maxMB (0 = no limit; all=true removes everything), evicts least-recently used clones until it fits.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager prepares review worktrees.
func NewManager ¶
NewManager builds a Manager. baseURL is the GitLab instance URL; token may be empty when transport is ssh.
func (*Manager) Ensure ¶
func (m *Manager) Ensure(ctx context.Context, mr gitlabx.MRDetail, progress func(string)) (*Checkout, error)
Ensure produces a worktree at the MR's head SHA, cloning or fetching as needed. progress receives human-readable status lines for the TUI.
func (*Manager) EvictIfNeeded ¶
func (m *Manager) EvictIfNeeded(ctx context.Context) (*CleanResult, error)
EvictIfNeeded enforces the configured cache budget in the background after a checkout; errors are reported to the caller for logging only.