gc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package gc decides which stacks can go: a pure function from what Docker and git know about each stack to the actions siding gc takes. It never removes git worktrees or branches, and never anything that could hold unmerged or uncommitted work.

Index

Constants

View Source
const (
	Merged       = "Merged"
	WorktreeGone = "WorktreeGone"
)

Reasons a stack goes. Part of the --json contract.

View Source
const (
	Dirty         = "Dirty"
	Unmerged      = "Unmerged"
	DefaultBranch = "DefaultBranch"
)

Reasons a stack stays. Part of the --json contract.

Variables

This section is empty.

Functions

func Plan

func Plan(stacks []Facts, machine string) (actions []Action, kept []Kept)

Plan returns what gc removes and what it keeps of the stacks of machine, each sorted by project. Stacks of other machines are neither removed nor listed.

Types

type Action

type Action struct {
	Project string
	Reason  string
	// Volumes: also remove the volumes, and with them the data.
	Volumes bool
}

Action removes a stack.

type Facts

type Facts struct {
	Project  string
	Branch   string
	Worktree string
	// Machine is the stack's dev.siding.machine; gc only acts on this machine's stacks.
	Machine string
	// WorktreeExists is false when the worktree directory is gone.
	WorktreeExists bool
	// Dirty: the worktree has changes. Only meaningful while it exists.
	Dirty bool
	// Merge is the branch's merge state; MergeKnown is false when git could not be asked (no
	// dev.siding.gitdir label, or the git directory is gone too).
	Merge      git.MergeState
	MergeKnown bool
}

Facts are what siding found out about one stack.

type Kept

type Kept struct {
	Project string
	Reason  string
}

Kept is a stack gc leaves alone.

Jump to

Keyboard shortcuts

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