api

package
v0.0.0-...-7b7ddc6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HashRE *regexp.Regexp = regexp.MustCompile(`[[:xdigit:]]{40}`)
)

Functions

func CookedErrorFromGitExec

func CookedErrorFromGitExec(stdout, stderr *bytes.Buffer, err error) error

Types

type CmdIntf

type CmdIntf interface {
	Run() error
}

type CommandFn

type CommandFn func(stdin io.Reader, stdout, stderr io.Writer, cwd string, cmd string, args ...string) CmdIntf

Functions that need to have their use of exec.Command tested should take a function-type argument that satisfies this type declaration. It's a "convenience" function that sets up all of the Cmd object's fields after instantiating it (fields are harder to mock). Just call this with all of the expected arguments, and it'll give you back something with a Run() function on it. When your caller passes nil for this function argument, use the defaultCommandImpl.

type Commit

type Commit struct {
	Hash
	Author string
	Date   time.Time
	Desc   string
}

type CommitList

type CommitList []Commit

func (*CommitList) ToJSON

func (c *CommitList) ToJSON() ([]byte, error)

type Disposition

type Disposition int
const (
	PRESENT Disposition = iota
	DELETED
)

type Hash

type Hash [40]byte

func MustBeHash

func MustBeHash(s string) (result Hash)

func (Hash) Equals

func (h Hash) Equals(other ShortHash) bool

func (Hash) Short

func (h Hash) Short() ShortHash

func (Hash) String

func (h Hash) String() string

type LocalGitRepo

type LocalGitRepo struct {
	Path string
}

Use OpenLocalGitRepo to create a LocalGitRepo based on a file system directory.

func OpenLocalGitRepo

func OpenLocalGitRepo(p string, cmdFn CommandFn) (*LocalGitRepo, error)

func (*LocalGitRepo) History

func (repo *LocalGitRepo) History(path string) (chan Commit, error)

func (*LocalGitRepo) Timelapse

func (repo *LocalGitRepo) Timelapse(p string) (Timelapse, error)

type ShortHash

type ShortHash [7]byte

func (ShortHash) String

func (h ShortHash) String() string

type Timelapse

type Timelapse []TimelapseHunk

type TimelapseHunk

type TimelapseHunk struct {
	Disposition
	Lines []string
}

func (TimelapseHunk) String

func (h TimelapseHunk) String() string

Jump to

Keyboard shortcuts

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