commit

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAuthorList

func BuildAuthorList(all []string, current string) []string

BuildAuthorList deduplicates all (may contain duplicates), sorts alphabetically, then prepends current as the first entry (removing it from its sorted position if present). If current is empty, the sorted deduplicated list is returned as-is.

func FillOutForm

func FillOutForm(
	ctx context.Context,
	cfg *config.AppConfig,
	defaults tui.CommitOption,
	hs historyStore,
	initialPrefill map[string]any,
) ([]byte, tui.CommitOption, error)

FillOutForm presents the commit TUI form and orchestrates the ctrl+r history flow. hs must not be nil; pass a *store.Store opened from store.OpenRepo.

Exit conditions:

  • form completed → saves payload to history, assembles and returns the commit message.
  • ctrl+r → shows history picker, then re-opens form (pre-filled or blank).
  • ctrl+c / esc → returns ("", zero, huh.ErrUserAborted).

Types

type IssueCloseInfo added in v0.12.0

type IssueCloseInfo struct {
	FromHash plumbing.Hash
	ToHash   plumbing.Hash
	Strategy MergeStrategy
}

type IssueHint added in v0.6.0

type IssueHint struct {
	IssueID      string
	BranchType   string
	IssueSubject string
	// Closing non-nil indicates this is a merge/close commit.
	Closing *IssueCloseInfo
}

IssueHint carries issue context detected from the current branch. Zero value means no issue branch — form fields are left unchanged.

func (IssueHint) Prefill added in v0.8.0

func (h IssueHint) Prefill(msgCfg config.CommitMessageConfig) map[string]any

Prefill returns the issue-hint contribution to a FillOutForm prefill map.

The issue reference always lands in the message: the footer receives msgCfg.RefFormat % id (or msgCfg.CloseFormat % id plus the merge summary when Closing is set); without a footer item the reference moves into the subject, and failing that into the body. scope independently receives the bare id when present.

BranchType is emitted as "type" when non-empty; loadForm validates it against cfg.CommitTypes and silently ignores an unconfigured value.

type MergeStrategy added in v0.12.0

type MergeStrategy string
const (
	MergeStrategySquash  MergeStrategy = "Squash"
	MergeStrategyRebase  MergeStrategy = "Rebase"
	MergeStrategyClassic MergeStrategy = "Classic"
)

Jump to

Keyboard shortcuts

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