Documentation ¶
Overview ¶
This file mainly provides some functions that can be used to adapt for git downloading by go-getter.
Index ¶
- Constants
- func Clone(repoURL string, tagName string, localPath string, writer io.Writer) (*git.Repository, error)
- func CloneWithOpts(opts ...CloneOption) (*git.Repository, error)
- func ForceProtocol(url, protocol string) string
- func GetAllGithubReleases(url string) ([]string, error)
- type CloneOption
- type CloneOptions
- type GitHubRelease
Constants ¶
const GIT_PROTOCOL = "git::"
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone(repoURL string, tagName string, localPath string, writer io.Writer) (*git.Repository, error)
Clone will clone from `repoURL` to `localPath` via git by tag name. Deprecated: This function will be removed in a future version. Use CloneWithOpts instead.
func CloneWithOpts ¶ added in v0.6.0
func CloneWithOpts(opts ...CloneOption) (*git.Repository, error)
CloneWithOpts will clone from `repoURL` to `localPath` via git by using CloneOptions
func ForceProtocol ¶ added in v0.8.1
func GetAllGithubReleases ¶ added in v0.8.7
GetAllGithubReleases fetches all releases from a GitHub repository
Types ¶
type CloneOption ¶ added in v0.6.0
type CloneOption func(*CloneOptions)
CloneOption is a function that modifies CloneOptions
func WithBranch ¶ added in v0.6.0
func WithBranch(branch string) CloneOption
WithBranch sets the branch for CloneOptions
func WithCommit ¶ added in v0.6.0
func WithCommit(commit string) CloneOption
WithCommit sets the commit for CloneOptions
func WithLocalPath ¶ added in v0.6.0
func WithLocalPath(localPath string) CloneOption
WithLocalPath sets the local path for CloneOptions
func WithRepoURL ¶ added in v0.6.0
func WithRepoURL(repoURL string) CloneOption
WithRepoURL sets the repo URL for CloneOptions
func WithTag ¶ added in v0.6.0
func WithTag(tag string) CloneOption
WithTag sets the tag for CloneOptions
func WithWriter ¶ added in v0.6.0
func WithWriter(writer io.Writer) CloneOption
WithWriter sets the writer for CloneOptions
type CloneOptions ¶ added in v0.6.0
type CloneOptions struct { RepoURL string Commit string Tag string Branch string LocalPath string Writer io.Writer }
CloneOptions is a struct for specifying options for cloning a git repository
func NewCloneOptions ¶ added in v0.8.0
func NewCloneOptions(repoUrl, commit, tag, branch, localpath string, Writer io.Writer) *CloneOptions
func (*CloneOptions) Clone ¶ added in v0.6.0
func (cloneOpts *CloneOptions) Clone() (*git.Repository, error)
Clone clones a git repository
func (*CloneOptions) ForceGitUrl ¶ added in v0.8.1
func (cloneOpts *CloneOptions) ForceGitUrl() (string, error)
ForceGitUrl will add the branch, tag or commit to the git URL and force it to the git protocol `<URL>` will return `Git::<URL>?ref=<branch|tag|commit>`
func (*CloneOptions) Validate ¶ added in v0.6.0
func (cloneOpts *CloneOptions) Validate() error
Validate checks if the CloneOptions are valid
type GitHubRelease ¶ added in v0.8.7
type GitHubRelease struct {
TagName string `json:"tag_name"`
}