gitops

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package gitops wraps common Git status and diff operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blame

func Blame(workspace string, path string, line int) (string, error)

func Branch

func Branch(workspace string) (string, error)

func Changelog

func Changelog(workspace string, limit int) (string, error)

func CreateBranch

func CreateBranch(workspace, name, startPoint string, checkout bool) (string, error)

func CreateTag

func CreateTag(workspace, name, ref, message string) (string, error)

func DeleteBranch

func DeleteBranch(workspace, name string, force bool) (string, error)

func DeleteTag

func DeleteTag(workspace, name string) (string, error)

func Diff

func Diff(workspace string, staged bool) (string, error)

func DiffChangedFilesWithOptions

func DiffChangedFilesWithOptions(workspace string, options DiffOptions) ([]string, error)

func DiffWithOptions

func DiffWithOptions(workspace string, options DiffOptions) (string, error)

func FormatStaleBaseWarning

func FormatStaleBaseWarning(check BaseCommitCheck) string
func Head(workspace string) (string, error)

func IsNoGitRepoError

func IsNoGitRepoError(err error) bool

func Log

func Log(workspace string, limit int) (string, error)

func RenameBranch

func RenameBranch(workspace, oldName, newName string) (string, error)

func Root

func Root(workspace string) (string, error)

func Run

func Run(workspace string, args ...string) (string, error)

func ShowTag

func ShowTag(workspace, name string) (string, error)

func StashApply

func StashApply(workspace string, ref string) (string, error)

func StashList

func StashList(workspace string) (string, error)

func StashPop

func StashPop(workspace string, ref string) (string, error)

func StashPush

func StashPush(workspace string, options StashPushOptions) (string, error)

func Status

func Status(workspace string) (string, error)

func SwitchBranch

func SwitchBranch(workspace, name string) (string, error)

func ValidateBaseCommitValue

func ValidateBaseCommitValue(value string) error

Types

type BaseCommitCheck

type BaseCommitCheck struct {
	Status   string            `json:"status"`
	Matches  bool              `json:"matches"`
	Source   *BaseCommitSource `json:"source,omitempty"`
	Expected string            `json:"expected,omitempty"`
	Actual   string            `json:"actual,omitempty"`
	Warning  string            `json:"warning,omitempty"`
}

func CheckBaseCommit

func CheckBaseCommit(workspace string, source *BaseCommitSource) BaseCommitCheck

func CheckBaseCommitForWorkspace

func CheckBaseCommitForWorkspace(workspace string, flagValue string) (BaseCommitCheck, error)

type BaseCommitSource

type BaseCommitSource struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
	Path  string `json:"path,omitempty"`
}

func ResolveExpectedBase

func ResolveExpectedBase(workspace string, flagValue string) (*BaseCommitSource, error)

type BlameEntry

type BlameEntry struct {
	Commit       string `json:"commit"`
	ShortCommit  string `json:"short_commit"`
	Author       string `json:"author"`
	AuthorEmail  string `json:"author_email,omitempty"`
	AuthorTime   int64  `json:"author_time,omitempty"`
	Summary      string `json:"summary,omitempty"`
	Filename     string `json:"filename,omitempty"`
	OriginalLine int    `json:"original_line"`
	FinalLine    int    `json:"final_line"`
	Line         string `json:"line"`
}

func BlameEntries

func BlameEntries(workspace string, path string, line int) ([]BlameEntry, error)

type BranchFreshness

type BranchFreshness struct {
	Branch              string            `json:"branch"`
	Base                string            `json:"base"`
	Upstream            string            `json:"upstream,omitempty"`
	HasUpstream         bool              `json:"has_upstream"`
	Status              string            `json:"status"`
	Fresh               bool              `json:"fresh"`
	Ahead               int               `json:"ahead"`
	Behind              int               `json:"behind"`
	MissingFixes        []string          `json:"missing_fixes,omitempty"`
	VerificationBlocked bool              `json:"verification_blocked"`
	RecoveryScenario    string            `json:"recovery_scenario,omitempty"`
	SuggestedAction     string            `json:"suggested_action,omitempty"`
	SuggestedCommands   []string          `json:"suggested_commands,omitempty"`
	Event               *laneevents.Event `json:"event,omitempty"`
}

func CheckBranchFreshness

func CheckBranchFreshness(workspace, branch, base string) (BranchFreshness, error)

type BranchInfo

type BranchInfo struct {
	Name     string `json:"name"`
	Current  bool   `json:"current"`
	Upstream string `json:"upstream,omitempty"`
	Commit   string `json:"commit,omitempty"`
	Subject  string `json:"subject,omitempty"`
}

type BranchList

type BranchList struct {
	Current  string       `json:"current"`
	Branches []BranchInfo `json:"branches"`
}

func ListBranches

func ListBranches(workspace string) (BranchList, error)

type CommitOptions

type CommitOptions struct {
	All     bool
	Message string
}

type CommitResult

type CommitResult struct {
	Commit  string `json:"commit"`
	Summary string `json:"summary"`
	Output  string `json:"output,omitempty"`
}

func Commit

func Commit(workspace string, options CommitOptions) (CommitResult, error)

type DiffOptions

type DiffOptions struct {
	Staged bool
	Paths  []string
}

type Identity

type Identity struct {
	HeadSHA      string `json:"head_sha,omitempty"`
	HeadShortSHA string `json:"head_short_sha,omitempty"`
	HeadRef      string `json:"head_ref,omitempty"`
	IsDetached   bool   `json:"is_detached"`
	IsBare       bool   `json:"is_bare"`
	IsWorktree   bool   `json:"is_worktree"`
	GitDir       string `json:"git_dir,omitempty"`
}

Identity describes the repository identity and current HEAD state.

func InspectIdentity

func InspectIdentity(workspace string) (Identity, error)

InspectIdentity returns HEAD and repository-layout metadata for workspace.

type LogEntry

type LogEntry struct {
	Commit      string `json:"commit"`
	ShortCommit string `json:"short_commit"`
	AuthorName  string `json:"author_name"`
	AuthorEmail string `json:"author_email"`
	Date        string `json:"date"`
	Subject     string `json:"subject"`
}

func LogEntries

func LogEntries(workspace string, limit int) ([]LogEntry, error)

type Operation

type Operation struct {
	Kind        string `json:"kind"`
	Paused      bool   `json:"paused"`
	GitDir      string `json:"git_dir,omitempty"`
	MarkerPath  string `json:"marker_path,omitempty"`
	ResumeHint  string `json:"resume_hint,omitempty"`
	AbortHint   string `json:"abort_hint,omitempty"`
	Description string `json:"description,omitempty"`
}

Operation describes an in-progress git operation that makes the workspace unsafe for unrelated lane work.

func InspectOperation

func InspectOperation(workspace string) (*Operation, error)

InspectOperation reports whether git is paused in a merge, rebase, cherry-pick, revert, or bisect operation.

type PreservedGitState

type PreservedGitState struct {
	RemoteBaseSHA  string                   `json:"remote_base_sha,omitempty"`
	RemoteBase     string                   `json:"remote_base,omitempty"`
	Patch          string                   `json:"patch"`
	UntrackedFiles []PreservedUntrackedFile `json:"untracked_files"`
	FormatPatch    string                   `json:"format_patch,omitempty"`
	HeadSHA        string                   `json:"head_sha,omitempty"`
	BranchName     string                   `json:"branch_name,omitempty"`
}

func PreserveStateForIssue

func PreserveStateForIssue(workspace string) (*PreservedGitState, error)

type PreservedUntrackedFile

type PreservedUntrackedFile struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

type StashInfo

type StashInfo struct {
	Ref     string `json:"ref"`
	Commit  string `json:"commit,omitempty"`
	Subject string `json:"subject,omitempty"`
}

func ListStashes

func ListStashes(workspace string) ([]StashInfo, error)

type StashPushOptions

type StashPushOptions struct {
	Message          string
	IncludeUntracked bool
}

type TagInfo

type TagInfo struct {
	Name    string `json:"name"`
	Commit  string `json:"commit,omitempty"`
	Subject string `json:"subject,omitempty"`
}

func ListTags

func ListTags(workspace, pattern string, limit int) ([]TagInfo, error)

Jump to

Keyboard shortcuts

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