Documentation
¶
Index ¶
- func CreateEmptyLocalGitDirectory() (string, error)
- func CreateLocalGitDirectory() (string, error)
- func CreateLocalGitDirectoryWithSubmodule() (string, error)
- func HasGitBinary() bool
- func IsLocalNonBareGitRepository(fs fs.FileSystem, dir string) (bool, error)
- func LocalNonBareGitRepositoryIsEmpty(fs fs.FileSystem, dir string) (bool, error)
- type CloneConfig
- type Git
- type SourceInfo
- type URL
- type URLType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEmptyLocalGitDirectory ¶ added in v1.1.8
CreateEmptyLocalGitDirectory creates a git directory with no checkin yet
func CreateLocalGitDirectory ¶ added in v1.1.8
CreateLocalGitDirectory creates a git directory with a commit
func CreateLocalGitDirectoryWithSubmodule ¶ added in v1.1.8
CreateLocalGitDirectoryWithSubmodule creates a git directory with a submodule
func HasGitBinary ¶ added in v1.1.8
func HasGitBinary() bool
HasGitBinary checks if the 'git' binary is available on the system
func IsLocalNonBareGitRepository ¶ added in v1.1.8
func IsLocalNonBareGitRepository(fs fs.FileSystem, dir string) (bool, error)
IsLocalNonBareGitRepository returns true if dir hosts a non-bare git repository, i.e. it contains a ".git" subdirectory or file (submodule case).
func LocalNonBareGitRepositoryIsEmpty ¶ added in v1.1.8
func LocalNonBareGitRepositoryIsEmpty(fs fs.FileSystem, dir string) (bool, error)
LocalNonBareGitRepositoryIsEmpty returns true if the non-bare git repository at dir has no refs or objects. It also handles the case of dir being a checked out git submodule.
Types ¶
type CloneConfig ¶ added in v1.1.8
CloneConfig specifies the options used when cloning the application source code.
type Git ¶
type Git interface {
Clone(source *URL, target string, opts CloneConfig) error
Checkout(repo, ref string) error
SubmoduleUpdate(repo string, init, recursive bool) error
LsTree(repo, ref string, recursive bool) ([]os.FileInfo, error)
GetInfo(string) *SourceInfo
}
Git is an interface used by main STI code to extract/checkout git repositories
func New ¶
func New(fs fs.FileSystem, runner cmd.CommandRunner) Git
New returns a new instance of the default implementation of the Git interface
type SourceInfo ¶ added in v1.1.8
type SourceInfo struct {
// Ref represents a commit SHA-1, valid Git branch name or a Git tag
// The output image will contain this information as 'io.openshift.build.commit.ref' label.
Ref string
// CommitID represents an arbitrary extended object reference in Git as SHA-1
// The output image will contain this information as 'io.openshift.build.commit.id' label.
CommitID string
// Date contains a date when the committer created the commit.
// The output image will contain this information as 'io.openshift.build.commit.date' label.
Date string
// AuthorName contains the name of the author
// The output image will contain this information (along with AuthorEmail) as 'io.openshift.build.commit.author' label.
AuthorName string
// AuthorEmail contains the e-mail of the author
// The output image will contain this information (along with AuthorName) as 'io.openshift.build.commit.author' lablel.
AuthorEmail string
// CommitterName contains the name of the committer
CommitterName string
// CommitterEmail contains the e-mail of the committer
CommitterEmail string
// Message represents the first 80 characters from the commit message.
// The output image will contain this information as 'io.openshift.build.commit.message' label.
Message string
// Location contains a valid URL to the original repository.
// The output image will contain this information as 'io.openshift.build.source-location' label.
Location string
// ContextDir contains path inside the Location directory that
// contains the application source code.
// The output image will contain this information as 'io.openshift.build.source-context-dir'
// label.
ContextDir string
}
SourceInfo stores information about the source code
type URL ¶ added in v1.1.8
URL represents a "Git URL"
func (URL) IsLocal ¶ added in v1.1.8
IsLocal returns true if the Git URL refers to a local repository
func (URL) LocalPath ¶ added in v1.1.8
LocalPath returns the path to a local repository in OS-native format. It is assumed that IsLocal() is true
func (URL) StringNoFragment ¶ added in v1.1.8
StringNoFragment returns a string representation of the URL without its fragment