Documentation
¶
Overview ¶
Package git contains functions for interacting with Git repositories using the Git CLI. As such, this package requires the Git CLI to be installed on the system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoHeadBranch is returned when a repository's HEAD (aka default) branch cannot // be determine ErrNoHeadBranch = errors.New("failed to find a head branch, does one exist?") // ErrNoRemoteHeadBranch is returned when a repository's remote default/HEAD branch // cannot be determined. ErrNoRemoteHeadBranch = errors.New("failed to get head branch from remote origin") )
This block contains errors and regexes
Functions ¶
func Clone ¶
Clone clone a git repository to a temporary directory and returns the path to the repository. If ref is empty, the default branch will be used. A shallow clone is performed.
optss is a variadic argument only to avoid a breaking change. Only one option struct is allowed, an error will be returned if more than one is provided.
func GetDefaultBranch ¶
GetDefaultBranch determines the default/HEAD branch for a given git repository.
Types ¶
type CloneOptions ¶ added in v0.3.0
type CloneOptions struct {
// UseArchive fetches the references using a tarball from the
// underlying VCS provider. This comes with the caveat that the
// downloaded tarball will not contain the .git directory. However,
// this can be much faster to download than a full clone.
//
// Currently, only Github URLs are supported.
//
// If this option fails, a normal clone will be performed without an
// error.
UseArchive bool
}
CloneOptions contains options accepted by Clone.
Click to show internal directories.
Click to hide internal directories.