Documentation
¶
Overview ¶
Package gitops wraps common Git status and diff operations.
Index ¶
- func Blame(workspace string, path string, line int) (string, error)
- func Branch(workspace string) (string, error)
- func Changelog(workspace string, limit int) (string, error)
- func CreateBranch(workspace, name, startPoint string, checkout bool) (string, error)
- func CreateTag(workspace, name, ref, message string) (string, error)
- func DeleteBranch(workspace, name string, force bool) (string, error)
- func DeleteTag(workspace, name string) (string, error)
- func Diff(workspace string, staged bool) (string, error)
- func DiffChangedFilesWithOptions(workspace string, options DiffOptions) ([]string, error)
- func DiffWithOptions(workspace string, options DiffOptions) (string, error)
- func FormatStaleBaseWarning(check BaseCommitCheck) string
- func Head(workspace string) (string, error)
- func IsNoGitRepoError(err error) bool
- func Log(workspace string, limit int) (string, error)
- func RenameBranch(workspace, oldName, newName string) (string, error)
- func Root(workspace string) (string, error)
- func Run(workspace string, args ...string) (string, error)
- func ShowTag(workspace, name string) (string, error)
- func StashApply(workspace string, ref string) (string, error)
- func StashList(workspace string) (string, error)
- func StashPop(workspace string, ref string) (string, error)
- func StashPush(workspace string, options StashPushOptions) (string, error)
- func Status(workspace string) (string, error)
- func SwitchBranch(workspace, name string) (string, error)
- func ValidateBaseCommitValue(value string) error
- type BaseCommitCheck
- type BaseCommitSource
- type BlameEntry
- type BranchFreshness
- type BranchInfo
- type BranchList
- type CommitOptions
- type CommitResult
- type DiffOptions
- type Identity
- type LogEntry
- type Operation
- type PreservedGitState
- type PreservedUntrackedFile
- type StashInfo
- type StashPushOptions
- type TagInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBranch ¶
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 IsNoGitRepoError ¶
func RenameBranch ¶
func SwitchBranch ¶
func ValidateBaseCommitValue ¶
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 BranchList ¶
type BranchList struct {
Current string `json:"current"`
Branches []BranchInfo `json:"branches"`
}
func ListBranches ¶
func ListBranches(workspace string) (BranchList, error)
type CommitOptions ¶
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 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 ¶
InspectIdentity returns HEAD and repository-layout metadata for workspace.
type LogEntry ¶
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 ¶
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 StashInfo ¶
type StashInfo struct {
Ref string `json:"ref"`
Commit string `json:"commit,omitempty"`
Subject string `json:"subject,omitempty"`
}
func ListStashes ¶
type StashPushOptions ¶
Click to show internal directories.
Click to hide internal directories.