git

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package git provides an integration with the git command

Index

Constants

This section is empty.

Variables

View Source
var ErrNoGit = errors.New("git not present in PATH")

ErrNoGit happens when git is not present in PATH.

View Source
var ErrNoTag = errors.New("git doesn't contain any tags")

ErrNoTag happens if the underlying git repository doesn't contain any tags.

Functions

func ExtractRepoFromURL

func ExtractRepoFromURL(s string) config.Repo

ExtractRepoFromURL gets the repo name from the remote URL.

Types

type ErrDirty

type ErrDirty struct {
	Status string
}

ErrDirty happens when the repo has uncommitted/unstashed changes.

func (ErrDirty) Error

func (e ErrDirty) Error() string

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

type Git struct {
	shell.Shell
}

Git wraps a shell.Shell provider to provide an interface over the git program in the PATH.

func New

func New(ctx *context.Context) *Git

New constructs a new Git instance with a default shell provider based on the login shell.

func (*Git) ExtractRepoFromConfig

func (git *Git) ExtractRepoFromConfig() (result config.Repo, err error)

ExtractRepoFromConfig gets the repo name from the Git config.

func (*Git) IsRepo

func (git *Git) IsRepo() bool

IsRepo returns true if current folder is a Git repository.

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

func (git *Git) RunInEnv(env map[string]string, args ...string) (*shell.CompletedProcess, error)

RunInEnv runs a Git command with the specified env vars and returns its output or errors.

func (*Git) SanitizeProcess

func (git *Git) SanitizeProcess(proc *shell.CompletedProcess, err error) (string, error)

SanitizeProcess cleans up the output.

func (*Git) Show

func (git *Git) Show(spec string) (string, error)

Show returns the requested information for the commit pointed to by HEAD.

func (*Git) ShowRef

func (git *Git) ShowRef(spec, ref string) (string, error)

ShowRef returns the requested information for the given ref.

Jump to

Keyboard shortcuts

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