git

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 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 AlreadyHaveRef added in v0.7.9

func AlreadyHaveRef(gitDir, sha string) bool

Returns true if ref is sha-like and is in the object database. The "sha-like" condition ensures that refs like `master` are always freshened.

func Checkout added in v0.7.9

func Checkout(gitDir, checkoutDir, ref string) error

func Clone added in v0.7.9

func Clone(
	ctx context.Context,
	url, gitDir string,
	messages io.Writer,
) error

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 CommitTimes added in v0.7.9

func CommitTimes(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 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 Describe added in v0.7.9

func Describe(gitDir, ref string) (desc string, err error)

func Fetch added in v0.7.9

func Fetch(
	ctx context.Context,
	gitDir, url string,
	messages io.Writer,
) (err error)

func GetSubmoduleRev

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

func GetSubmoduleRevs

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

func HaveFile added in v0.7.9

func HaveFile(gitDir, ref, path string) (ok bool, err error)

func LocalMirror added in v0.7.9

func LocalMirror(
	url, gitDir, ref string,
	messages io.Writer,
) (err error)

Creates or updates a mirror of `url` at `gitDir` using `git clone --mirror`

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 RevParse added in v0.7.9

func RevParse(gitDir, ref string) (sha string, err error)

func SafeCleanup

func SafeCleanup(path string) error

func SetMTimes added in v0.7.9

func SetMTimes(git_dir, checkout_dir, ref 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