Documentation ¶
Overview ¶
Package git allows working with Git repositories
Index ¶
- Constants
- Variables
- func IsBareRoot(path string) (bool, error)
- func IsExitCode(err error, exitCode int) bool
- func IsGitInstalled() bool
- func NameFromRepositoryURL(url *url.URL) (string, bool)
- func ParseRepository(s string) (*url.URL, error)
- type ChangedRef
- type GitError
- type Repository
- type SourceInfo
- type TimeoutError
Constants ¶
const ( // Shallow maps to --depth=1, which clones a Git repository without // downloading history Shallow = "--depth=1" )
Variables ¶
var ErrGitNotAvailable = errors.New("git binary not available")
ErrGitNotAvailable will be returned if the git call fails because a git binary could not be found
Functions ¶
func IsBareRoot ¶ added in v0.5.1
IsRoot returns true if location is the root of a bare git repository
func IsExitCode ¶ added in v1.1.6
func IsGitInstalled ¶ added in v1.3.0
func IsGitInstalled() bool
func NameFromRepositoryURL ¶ added in v0.5.1
NameFromRepositoryURL suggests a name for a repository URL based on the last segment of the path, or returns false
Types ¶
type ChangedRef ¶ added in v0.5.1
func ParsePostReceive ¶ added in v0.5.1
func ParsePostReceive(r io.Reader) ([]ChangedRef, error)
type GitError ¶ added in v0.5.1
GitError is returned when the underlying Git command returns a non-zero exit code.
type Repository ¶
type Repository interface { GetRootDir(dir string) (string, error) GetOriginURL(dir string) (string, bool, error) GetRef(dir string) string Clone(dir string, url string) error CloneWithOptions(dir string, url string, args ...string) error CloneBare(dir string, url string) error CloneMirror(dir string, url string) error Fetch(dir string, url string, ref string) error Checkout(dir string, ref string) error PotentialPRRetryAsFetch(dir string, url string, ref string, err error) error SubmoduleUpdate(dir string, init, recursive bool) error Archive(dir, ref, format string, w io.Writer) error Init(dir string, bare bool) error Add(dir string, spec string) error Commit(dir string, message string) error AddRemote(dir string, name, url string) error AddLocalConfig(dir, name, value string) error ShowFormat(dir, commit, format string) (string, error) ListRemote(url string, args ...string) (string, string, error) TimedListRemote(timeout time.Duration, url string, args ...string) (string, string, error) GetInfo(location string) (*SourceInfo, []error) }
Repository represents a git source repository
func NewRepositoryForBinary ¶ added in v0.5.1
func NewRepositoryForBinary(gitBinaryPath string) Repository
NewRepositoryForBinary returns a Repository using the specified git executable.
func NewRepositoryForBinaryWithEnvironment ¶ added in v1.1.1
func NewRepositoryForBinaryWithEnvironment(gitBinaryPath string, env []string) Repository
NewRepositoryForBinary returns a Repository using the specified git executable and environment
func NewRepositoryWithEnv ¶ added in v1.1.1
func NewRepositoryWithEnv(env []string) Repository
NewRepositoryForEnv creates a new Repository using the specified environment
type SourceInfo ¶ added in v1.1.1
type SourceInfo struct {
s2iapi.SourceInfo
}
SourceInfo stores information about the source code
type TimeoutError ¶ added in v1.3.0
type TimeoutError struct {
Err error
}
TimeoutError is returned when the underlying Git coommand times out before finishing
func (*TimeoutError) Error ¶ added in v1.3.0
func (e *TimeoutError) Error() string