git

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConventionalCommit

func ParseConventionalCommit(message string) (ccType, scope, subject string)

ParseConventionalCommit extracts type, scope, and subject from a commit message. If the message doesn't match Conventional Commits format, type and scope are empty and subject is the full message.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements domain.GitAdapter via exec.Command("git", ...).

func New

func New(workDir string) *Adapter

New creates an Adapter for the given working directory (M4: canonical constructor name).

func NewAdapter

func NewAdapter(workDir string) *Adapter

NewAdapter is an alias for New, kept for compatibility with existing callers.

func (*Adapter) CommitExists

func (a *Adapter) CommitExists(ref string) (bool, error)

func (*Adapter) CommitMessageContains

func (a *Adapter) CommitMessageContains(ref, marker string) (bool, error)

func (*Adapter) CommitRange added in v1.0.0

func (a *Adapter) CommitRange(from, to string) ([]string, error)

func (*Adapter) CurrentBranch added in v1.0.0

func (a *Adapter) CurrentBranch() (string, error)

CurrentBranch returns the current branch name. Returns "" (no error) when HEAD is detached (rebase, CI, etc.).

func (*Adapter) DefaultBranch added in v1.1.0

func (a *Adapter) DefaultBranch() (string, error)

DefaultBranch returns the repo's default branch name (e.g. "main", "master"). Reads from origin/HEAD. Returns "" if not determinable.

func (*Adapter) Diff

func (a *Adapter) Diff(ref string) (string, error)

func (*Adapter) GitDir

func (a *Adapter) GitDir() (string, error)

func (*Adapter) HeadCommit added in v1.0.0

func (a *Adapter) HeadCommit() (*domain.CommitInfo, error)

HeadCommit returns the full commit info for HEAD in a single git invocation, avoiding multiple exec.Command calls. It replaces separate HeadRef() + Log() calls with one `git log` invocation.

func (*Adapter) HeadRef

func (a *Adapter) HeadRef() (string, error)

func (*Adapter) HookExists

func (a *Adapter) HookExists(hookType string) (bool, error)

func (*Adapter) InstallHook

func (a *Adapter) InstallHook(hookType string) (domain.InstallResult, error)

func (*Adapter) IsInsideWorkTree

func (a *Adapter) IsInsideWorkTree() bool

func (*Adapter) IsMergeCommit

func (a *Adapter) IsMergeCommit(ref string) (bool, error)

func (*Adapter) IsRebaseInProgress

func (a *Adapter) IsRebaseInProgress() (bool, error)

func (*Adapter) LatestTag added in v1.0.0

func (a *Adapter) LatestTag() (string, error)

func (*Adapter) Log

func (a *Adapter) Log(ref string) (*domain.CommitInfo, error)

func (*Adapter) LogAll added in v1.0.0

func (a *Adapter) LogAll() ([]domain.CommitInfo, error)

LogAll returns all commits in the repository.

func (*Adapter) LogAllWithLimit added in v1.0.0

func (a *Adapter) LogAllWithLimit(maxCommits int) ([]domain.CommitInfo, error)

LogAllWithLimit returns up to maxCommits from git log --all. If maxCommits <= 0, all commits are returned (no limit). This method is not part of the GitAdapter interface; use it directly on *Adapter when you need bounded output (e.g. doctor rebuild).

func (*Adapter) UninstallHook

func (a *Adapter) UninstallHook(hookType string) error

Jump to

Keyboard shortcuts

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