stacklog

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package stacklog gathers the current stack's commit band for the stack-aware `stackit log` view: the commits on the branch you're standing on and its ancestors down to (but not including) trunk, ordered top-down from HEAD. It also surfaces the branch/tag decorations and trunk-tip marker the renderer needs to draw a git-log-style view with a clear trunk boundary. The result is presentation-agnostic so CLI/JSON adapters can render it however they need.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name      string
	IsCurrent bool
	Commits   []Commit
}

Branch is one branch in the current stack's ancestor path, with its own commits ordered newest-first (the branch tip first).

type Commit

type Commit struct {
	SHA     string
	Subject string
}

Commit is one commit on a stack branch, identified by its full SHA so the renderer can join it against the decoration map.

type Result

type Result struct {
	Branches    []Branch
	TrunkName   string
	TrunkTipSHA string // full SHA of the trunk tip, for the boundary marker
	Decorations map[string][]git.RefDecoration
}

Result is the gathered stack band.

Branches are ordered top-down: the branch you're standing on first, its trunk-most ancestor last; trunk itself is excluded (it's the boundary). When HEAD is on trunk or detached, Branches is empty, so callers render trunk history alone.

Decorations is keyed by full commit SHA and covers every local branch head and tag, so the renderer can annotate both the stack band and the trunk band from one map.

func Gather

func Gather(src Source) (Result, error)

Gather collects the current stack's ancestor-path commits plus the decoration map and trunk-tip marker. It never walks above HEAD (children are out of scope) and excludes trunk from the band.

type Source

type Source interface {
	CurrentBranch() *engine.Branch
	Trunk() engine.Branch
	Graph(strategy engine.SortStrategy) *engine.StackGraph
	BatchCommits(branches engine.Branches, format engine.CommitFormat) map[string][]string
	RefDecorations() (map[string][]git.RefDecoration, error)
	GetRevisionForName(branchName string) (string, error)
}

Source is the narrow engine dependency this action needs. engine.Engine satisfies it.

Jump to

Keyboard shortcuts

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