Help us shape the future of Go! Take the 2026 Go Developer Survey

reorder

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package reorder implements the reorder command, which reorders the branches between trunk and the current branch and restacks their descendants.

Index

Constants

This section is empty.

Variables

View Source
var ErrCanceled = errors.New("reorder canceled")

ErrCanceled is returned by an OrderEditor when the user cancels.

Functions

func Action

func Action(ctx context.Context, deps Deps, opts Options) error

Action performs the reorder operation

Types

type Deps

type Deps struct {
	Engine Engine
	actions.MutationDeps
}

Deps are the collaborators reorder needs. Adapters build them from their own runtime state; the action never sees bootstrap types.

type Engine

type Engine interface {
	validation.GitOperationEngine
	actions.OwnershipEngine
	Trunk() engine.Branch
	Graph(ctx context.Context, strategy engine.SortStrategy) *engine.StackGraph
	ReparentBranchesToParents(ctx context.Context, moves []engine.BranchParentMove, opts engine.ReparentOpts) error
}

Engine lists exactly the engine methods reorder calls: the precondition checks, the ownership guard, the stack reads, and the parent rewrite.

type Options

type Options struct {
	// Editor is the interactive order editor. When nil, the order is edited
	// as text in $EDITOR instead.
	Editor OrderEditor
}

Options configures Action.

type OrderEditor

type OrderEditor interface {
	// EditOrder receives branches tip-first (trunk is passed only for
	// display) and returns the new tip-first order. It returns
	// ErrCanceled when the user cancels.
	EditOrder(branchesTipFirst []string, trunk string) ([]string, error)
}

OrderEditor lets the user interactively choose a new branch order. Implementations live in adapters (e.g. the CLI's Bubble Tea reorder view).

Jump to

Keyboard shortcuts

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