git

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2015 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const GIT_BASE_DIR = "repo"

Variables

View Source
var (
	ErrEmptyRepoName         = errors.New("Empty repository name")
	ErrEmptyRepoOrganization = errors.New("Empty repository organization")
	ErrUserNotAllowed        = errors.New("User not in the allowed set")
)
View Source
var ErrSkipGithubEndpoint = errors.New("Github endpoint skipped")
View Source
var ShaLike = regexp.MustCompile("[0-9a-zA-Z]{40}")

Functions

func Command

func Command(workdir, command string, args ...string) *exec.Cmd

Invoke a `command` in `workdir` with `args`, connecting up its Stdout and Stderr

func ContextRun

func ContextRun(ctx context.Context, cmd *exec.Cmd) error

Run cmd within a net Context. If the context is cancelled or times out, the process is killed.

func GetSubmoduleRev

func GetSubmoduleRev(gitDir, submodulePath, mainRev string) (string, error)

func GetSubmoduleRevs

func GetSubmoduleRevs(gitDir, mainRev string, submodules []Submodule) error

func GitCommitTimes

func GitCommitTimes(gitDir, revision string) (map[string]time.Time, error)

Return the most recent committed timestamp of each file in the whole of history. It's faster than invoking 'git log -1' on each file.

func GitSetMTimes

func GitSetMTimes(gitDir, checkoutDir, ref string) error

func MultipleErrors

func MultipleErrors(errs <-chan error) error

Read errors out of a channel, counting only the non-nil ones. If there are zero non-nil errs, nil is returned.

func PrepSubmodules

func PrepSubmodules(
	gitDir, checkoutDir, mainRev string,
) error

func SafeCleanup

func SafeCleanup(path string) error

Types

type BuildDirectory

type BuildDirectory struct {
	Name, Dir string
	Cleanup   func()
}

func PrepBuildDirectory

func PrepBuildDirectory(
	gitDir, remote, ref string,
) (*BuildDirectory, error)

type ErrMultiple

type ErrMultiple struct {
	// contains filtered or unexported fields
}

func (*ErrMultiple) Error

func (em *ErrMultiple) Error() string

type GithubStatus

type GithubStatus struct {
	State       string `json:"state"`
	TargetUrl   string `json:"target_url"`
	Description string `json:"description"`
}

type JustNongithub

type JustNongithub struct {
	NonGithub NonGithub `json:"nongithub"`
}

func ParseJustNongithub

func ParseJustNongithub(in []byte) (j JustNongithub, err error)

type NonGithub

type NonGithub struct {
	NoBuild bool `json:"nobuild"`
	Wait    bool `json:"wait"`
}

type PushEvent

type PushEvent struct {
	Ref        string     `json:"ref"`
	Deleted    bool       `json:"deleted"`
	Repository Repository `json:"repository"`
	After      string     `json:"after"`
	Pusher     Pusher     `json:"pusher"`
	NonGithub  NonGithub  `json:"nongithub"`
	HtmlUrl    string     `json:"html_url"`
}

type Pusher

type Pusher struct {
	Name string `json:"name"`
}

type Repository

type Repository struct {
	Name         string `json:"name"`
	Url          string `json:"url"`
	Organization string `json:"organization"`
}

type Submodule

type Submodule struct {
	Path, URL string
	Rev       string // populated by GetSubmoduleRevs
}

func ParseSubmodules

func ParseSubmodules(filename string) (submodules []Submodule, err error)

Jump to

Keyboard shortcuts

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