Documentation
¶
Overview ¶
Package git provides an integration with the git command
Index ¶
- Variables
- type ErrDirty
- type ErrNotRepository
- type ErrWrongRef
- type Git
- func (git *Git) ExtractRepoFromConfig() (result Repo, err error)
- func (git *Git) IsRepo() bool
- func (git *Git) Run(args ...string) (*shell.CompletedProcess, error)
- func (git *Git) RunInEnv(env map[string]string, args ...string) (*shell.CompletedProcess, error)
- func (git *Git) SanitizeProcess(proc *shell.CompletedProcess, err error) (string, error)
- func (git *Git) Show(spec string) (string, error)
- func (git *Git) ShowRef(spec, ref string) (string, error)
- type Repo
- type SanitizedError
Constants ¶
This section is empty.
Variables ¶
var ErrNoGit = errors.New("git not present in PATH")
ErrNoGit happens when git is not present in PATH.
var ErrNoRemoteOrigin = errors.New("repository doesn't have an `origin` remote")
ErrNoRemoteOrigin happens when the repository has no remote named "origin".
var ErrNoTag = errors.New("git doesn't contain any tags")
ErrNoTag happens if the underlying git repository doesn't contain any tags.
Functions ¶
This section is empty.
Types ¶
type ErrDirty ¶
type ErrDirty struct {
Status string
}
ErrDirty happens when the repo has uncommitted/unstashed changes.
type ErrNotRepository ¶
type ErrNotRepository struct {
Dir string
}
ErrNotRepository happens if you try to run Cider against a folder which is not a git repository.
func (ErrNotRepository) Error ¶
func (e ErrNotRepository) Error() string
type ErrWrongRef ¶
type ErrWrongRef struct {
Commit, Tag string
}
ErrWrongRef happens when the HEAD reference is different from the tag being built.
func (ErrWrongRef) Error ¶
func (e ErrWrongRef) Error() string
type Git ¶
Git wraps a shell.Shell provider to provide an interface over the git program in the PATH.
func New ¶
New constructs a new Git instance with a default shell provider based on the login shell.
func (*Git) ExtractRepoFromConfig ¶
ExtractRepoFromConfig gets the repo name from the Git config.
func (*Git) Run ¶
func (git *Git) Run(args ...string) (*shell.CompletedProcess, error)
Run runs a Git command and returns its output or errors.
func (*Git) RunInEnv ¶
RunInEnv runs a Git command with the specified env vars and returns its output or errors.
func (*Git) SanitizeProcess ¶
SanitizeProcess cleans up the output.
type Repo ¶ added in v0.0.7
Repo represents any kind of repo (github, gitlab, etc).
func ExtractRepoFromURL ¶
ExtractRepoFromURL gets the repo name from the remote URL.
type SanitizedError ¶ added in v0.0.8
type SanitizedError struct {
// contains filtered or unexported fields
}
SanitizedError wraps the contents of a sanitized Git error.
func (SanitizedError) Error ¶ added in v0.0.8
func (e SanitizedError) Error() string