Documentation ¶
Index ¶
- Variables
- func AlreadyHaveRef(gitDir, sha string) bool
- func Checkout(gitDir, checkoutDir, ref string) error
- func Chtimes(path string, atime, mtime time.Time) error
- func Clone(ctx context.Context, url, gitDir string, messages io.Writer) error
- func Command(workdir, command string, args ...string) *exec.Cmd
- func CommitTimes(gitDir, revision string) (map[string]time.Time, error)
- func ContextRun(ctx context.Context, cmd *exec.Cmd) error
- func Describe(gitDir, ref string) (desc string, err error)
- func Fetch(ctx context.Context, gitDir, url string, messages io.Writer) error
- func GetSubmoduleRev(gitDir, submodulePath, mainRev string) (string, error)
- func GetSubmoduleRevs(gitDir, mainRev string, submodules []Submodule) error
- func HaveFile(gitDir, ref, path string) (ok bool, err error)
- func LocalMirror(url, gitDir, ref string, timeout time.Duration, messages io.Writer) error
- func MultipleErrors(errs <-chan error) error
- func PrepSubmodules(gitDir, checkoutDir, mainRev string, timeout time.Duration, messages io.Writer) error
- func RecursiveCheckout(gitDir, checkoutPath, rev string, timeout time.Duration, messages io.Writer) error
- func RevParse(gitDir, ref string) (sha string, err error)
- func SafeCleanup(path string) error
- func SetMTimes(gitDir, checkoutDir, ref string) error
- type BuildDirectory
- type ErrMultiple
- type Submodule
Constants ¶
This section is empty.
Variables ¶
var ShaLike = regexp.MustCompile("[0-9a-zA-Z]{40}")
ShaLike specifies a valid git hash.
Functions ¶
func AlreadyHaveRef ¶
AlreadyHaveRef 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 Command ¶
Command invokes a `command` in `workdir` with `args`, connecting Stdout and Stderr to Stderr.
func CommitTimes ¶
CommitTimes returns 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 ¶
ContextRun runs cmd within a net Context. If the context is cancelled or times out, the process is killed.
func Describe ¶
Describe describes a commit given a reference using the most recent tag reachable from it.
func GetSubmoduleRev ¶
GetSubmoduleRev returns the revisions of all files in a given submodule.
func GetSubmoduleRevs ¶
GetSubmoduleRevs returns the revisions of all files in a given list of submodules.
func LocalMirror ¶
LocalMirror creates or updates a mirror of `url` at `gitDir` using `git clone --mirror`.
func MultipleErrors ¶
MultipleErrors reads 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, timeout time.Duration, messages io.Writer) error
PrepSubmodules in parallel initializes all submodules and additionally stores them in a local cache.
func RecursiveCheckout ¶
func RecursiveCheckout(gitDir, checkoutPath, rev string, timeout time.Duration, messages io.Writer) error
RecursiveCheckout recursively checks out repositories; similar to "git clone --recursive".
func SafeCleanup ¶
SafeCleanup recursively removes all files from a given path, which has to be a subfolder of the current working directory.
Types ¶
type BuildDirectory ¶
BuildDirectory holds the git rev and path to a cloned git repository. It also holds a cleanup function to safely remove this directory.
func PrepBuildDirectory ¶
func PrepBuildDirectory(gitDir, remote, ref string, timeout time.Duration, messages io.Writer) (*BuildDirectory, error)
PrepBuildDirectory clones a given repository and checks out the given revision, setting the timestamp of all files to their commit time and putting all submodules into a submodule cache.
type ErrMultiple ¶
type ErrMultiple struct {
// contains filtered or unexported fields
}
ErrMultiple holds a list of errors.
func (*ErrMultiple) Error ¶
func (em *ErrMultiple) Error() string
type Submodule ¶
Submodule holds the path, url, and revision to a submodule.
func ParseSubmodules ¶
ParseSubmodules returns all submodule definitions given a .gitmodules configuration.