Documentation
¶
Overview ¶
Package gitexec provides context-aware shell execution for git and gh.
Index ¶
- func IsDeadline(err error) bool
- func RepoBaseName(root string) string
- func SSHURLFromNameWithOwner(nameWithOwner string) string
- func TrimmedStdout(result Result) string
- type CommandError
- type CommitInfo
- type ExecRunner
- type Git
- func (g *Git) AheadBehind(ctx context.Context, dir, left, right string) (int, int, error)
- func (g *Git) CurrentBranch(ctx context.Context, root string) (string, error)
- func (g *Git) GitDir(ctx context.Context, root string) (string, error)
- func (g *Git) HasHead(ctx context.Context, dir string) bool
- func (g *Git) HeadSHA(ctx context.Context, root string) (string, error)
- func (g *Git) HeadShortSHA(ctx context.Context, root string) (string, error)
- func (g *Git) HeadSubject(ctx context.Context, root string) (string, error)
- func (g *Git) IsDirty(ctx context.Context, dir string) (bool, error)
- func (g *Git) LastCommit(ctx context.Context, dir string) (CommitInfo, error)
- func (g *Git) RefExists(ctx context.Context, dir, ref string) bool
- func (g *Git) Root(ctx context.Context, dir string) (string, error)
- type Result
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDeadline ¶
IsDeadline reports whether err is caused by context timeout or cancellation.
func RepoBaseName ¶
RepoBaseName returns the repository directory name.
func SSHURLFromNameWithOwner ¶
SSHURLFromNameWithOwner returns a deterministic GitHub SSH URL.
func TrimmedStdout ¶
TrimmedStdout returns stdout without surrounding whitespace.
Types ¶
type CommandError ¶
type CommandError struct {
Name string
Args []string
Dir string
Stderr string
// ExitCode is the process exit code, or -1 when unavailable.
ExitCode int
Err error
}
CommandError wraps an external command failure with useful context.
func (*CommandError) Error ¶
func (e *CommandError) Error() string
Error returns a concise command failure message.
func (*CommandError) Unwrap ¶
func (e *CommandError) Unwrap() error
Unwrap returns the underlying process error.
type CommitInfo ¶
CommitInfo describes the current HEAD commit.
type ExecRunner ¶
type ExecRunner struct{}
ExecRunner runs commands with os/exec.
type Git ¶
type Git struct{}
Git wraps common git operations used by skeeper.
func (*Git) AheadBehind ¶
AheadBehind counts commits reachable from left but not right, and right but not left.
func (*Git) CurrentBranch ¶
CurrentBranch returns the checked-out branch name.
func (*Git) HeadShortSHA ¶
HeadShortSHA returns the short current HEAD SHA.
func (*Git) HeadSubject ¶
HeadSubject returns the current HEAD subject.
func (*Git) LastCommit ¶
LastCommit returns the short hash and commit time for HEAD.