{"modulePath":"github.phpd.cn/openshift/origin","version":"v3.10.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package git\n\nPackage git allows working with Git repositories\n\n## Constants\n\n```go\nconst (\n\n\t// Shallow maps to --depth=1, which clones a Git repository without\n\t// downloading history\n\tShallow = \"--depth=1\"\n)\n```\n\n## Variables\n\n```go\nvar ErrGitNotAvailable = errors.New(\"git binary not available\")\n```\nErrGitNotAvailable will be returned if the git call fails because a git binary could not be found\n\n## Functions\n\n```go\nfunc IsBareRoot(path string) (bool, error)\n```\nIsRoot returns true if location is the root of a bare git repository\n\n```go\nfunc IsExitCode(err error, exitCode int) bool\n```\n\n```go\nfunc IsGitInstalled() bool\n```\n\n```go\nfunc NameFromRepositoryURL(url *url.URL) (string, bool)\n```\nNameFromRepositoryURL suggests a name for a repository URL based on the last segment of the path, or returns false\n\n## Types\n\n```go\ntype ChangedRef struct {\n\tRef string\n\tOld string\n\tNew string\n}\n```\n\n```go\nfunc ParsePostReceive(r io.Reader) ([]ChangedRef, error)\n```\n\n```go\ntype GitError struct {\n\tErr    error\n\tStdout string\n\tStderr string\n}\n```\nGitError is returned when the underlying Git command returns a non-zero exit code.\n\n```go\nfunc (e *GitError) Error() string\n```\n\n```go\ntype Repository interface {\n\tGetRootDir(dir string) (string, error)\n\tGetOriginURL(dir string) (string, bool, error)\n\tGetRef(dir string) string\n\tClone(dir string, url string) error\n\tCloneWithOptions(dir string, url string, args ...string) error\n\tCloneBare(dir string, url string) error\n\tCloneMirror(dir string, url string) error\n\tFetch(dir string, url string, ref string) error\n\tCheckout(dir string, ref string) error\n\tPotentialPRRetryAsFetch(dir string, url string, ref string, err error) error\n\tSubmoduleUpdate(dir string, init, recursive bool) error\n\tArchive(dir, ref, format string, w io.Writer) error\n\tInit(dir string, bare bool) error\n\tAdd(dir string, spec string) error\n\tCommit(dir string, message string) error\n\tAddRemote(dir string, name, url string) error\n\tAddLocalConfig(dir, name, value string) error\n\tShowFormat(dir, commit, format string) (string, error)\n\tListRemote(url string, args ...string) (string, string, error)\n\tTimedListRemote(timeout time.Duration, url string, args ...string) (string, string, error)\n\tGetInfo(location string) (*SourceInfo, []error)\n}\n```\nRepository represents a git source repository\n\n```go\nfunc NewRepository() Repository\n```\nNewRepository creates a new Repository\n\n```go\nfunc NewRepositoryForBinary(gitBinaryPath string) Repository\n```\nNewRepositoryForBinary returns a Repository using the specified git executable.\n\n```go\nfunc NewRepositoryForBinaryWithEnvironment(gitBinaryPath string, env []string) Repository\n```\nNewRepositoryForBinary returns a Repository using the specified git executable and environment\n\n```go\nfunc NewRepositoryWithEnv(env []string) Repository\n```\nNewRepositoryForEnv creates a new Repository using the specified environment\n\n```go\ntype SourceInfo struct {\n\ts2igit.SourceInfo\n}\n```\nSourceInfo stores information about the source code\n\n```go\ntype TimeoutError struct {\n\tErr error\n}\n```\nTimeoutError is returned when the underlying Git coommand times out before finishing\n\n```go\nfunc (e *TimeoutError) Error() string\n```\n\n","path":"github.phpd.cn/openshift/origin/pkg/git","name":"git","synopsis":"Package git allows working with Git repositories","isRedistributable":true}
