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 ¶
CreateEmptyLocalGitDirectory creates a git directory with no checkin yet
func CreateLocalGitDirectory ¶
CreateLocalGitDirectory creates a git directory with a commit
func CreateLocalGitDirectoryWithSubmodule ¶
CreateLocalGitDirectoryWithSubmodule creates a git directory with a submodule
func HasGitBinary ¶
func HasGitBinary() bool
HasGitBinary checks if the 'git' binary is available on the system
func IsLocalNonBareGitRepository ¶
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 ¶
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 ¶
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 ¶
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 // Binary file name. BinaryName string // Binary file size. BinarySize uint64 }
SourceInfo stores information about the source code
type URL ¶
URL represents a "Git URL"
func (URL) LocalPath ¶
LocalPath returns the path to a local repository in OS-native format. It is assumed that IsLocal() is true
func (URL) StringNoFragment ¶
StringNoFragment returns a string representation of the URL without its fragment