Documentation
¶
Index ¶
- Constants
- Variables
- type BranchName
- type Git
- type GitRepo
- type GitRepoStruct
- func (u *GitRepoStruct) GetBranch() string
- func (u *GitRepoStruct) GetCloneURL() *url.URL
- func (u *GitRepoStruct) GetLocalPath() string
- func (u *GitRepoStruct) GetName() string
- func (u *GitRepoStruct) GetTag() string
- func (u *GitRepoStruct) SetBranch(b string)
- func (u *GitRepoStruct) SetLocalPath(p string)
- func (u *GitRepoStruct) SetTag(t string)
- type GoGit
- func (g *GoGit) CheckoutCommit(ctx context.Context, commitHash string) error
- func (g *GoGit) Clone(ctx context.Context) error
- func (g *GoGit) CurrentReference() (string, error)
- func (g *GoGit) EnsureCommit(ctx context.Context, commitHash string) (string, error)
- func (g *GoGit) FetchNonExistingBranch(ctx context.Context, branch string) error
- func (g *GoGit) SetProxy(p string) error
- type TagName
Constants ¶
View Source
const ( //DefaultMainReferenceName plumbing.ReferenceName = "refs/heads/main" OriginName string = "origin" MainBranch BranchName = "main" BranchPrefixInRemoteRepo = "refs/remotes/" + OriginName + "/" BranchPrefixInLocalRepo = "refs/heads/" TagsPrefixInLocalRepo = "refs/tags/" TagsPrefixInRemoteRepo = "refs/tags/" )
Variables ¶
View Source
var (
DefaultMainReferenceName plumbing.ReferenceName = plumbing.ReferenceName(BranchPrefixInLocalRepo + "/" + string(MainBranch))
)
Functions ¶
This section is empty.
Types ¶
type BranchName ¶ added in v0.0.47
type BranchName string
BranchName represents a relative branch name (i.e. 'main', 'drafts/bucket/v1') and supports transformation to the ReferenceName in local (cached) repository (those references are in the form 'refs/remotes/origin/...') or in the remote repository (those references are in the form 'refs/heads/...').
func (BranchName) BranchInLocal ¶ added in v0.0.47
func (b BranchName) BranchInLocal() plumbing.ReferenceName
func (BranchName) BranchInRemote ¶ added in v0.0.47
func (b BranchName) BranchInRemote() plumbing.ReferenceName
type GitRepo ¶
type GitRepoStruct ¶
type GitRepoStruct struct {
// CloneURL is the URL that will be used for cloning the repo
CloneURL *url.URL
RepositoryName string
// GitBranch is the referenced Git branch name.
GitBranch string
// Tag name - either tag or branch should be set.
Tag string
LocalRepoPath string
}
GitRepoStruct is a struct that contains all the fields required for a GitRepo instance.
func (*GitRepoStruct) GetBranch ¶
func (u *GitRepoStruct) GetBranch() string
GetBranch returns the referenced Git branch name. the empty string is returned otherwise.
func (*GitRepoStruct) GetCloneURL ¶
func (u *GitRepoStruct) GetCloneURL() *url.URL
GetCloneURL returns the CloneURL of the repository.
func (*GitRepoStruct) GetLocalPath ¶
func (u *GitRepoStruct) GetLocalPath() string
func (*GitRepoStruct) GetName ¶
func (u *GitRepoStruct) GetName() string
GetName returns the repository name.
func (*GitRepoStruct) GetTag ¶
func (u *GitRepoStruct) GetTag() string
func (*GitRepoStruct) SetBranch ¶
func (u *GitRepoStruct) SetBranch(b string)
func (*GitRepoStruct) SetLocalPath ¶
func (u *GitRepoStruct) SetLocalPath(p string)
func (*GitRepoStruct) SetTag ¶
func (u *GitRepoStruct) SetTag(t string)
type GoGit ¶
func NewGoGit ¶
func NewGoGit(gitRepo GitRepo, secret types.NamespacedName, credentialResolver auth.CredentialResolver) *GoGit
func (*GoGit) CheckoutCommit ¶ added in v0.0.47
func (*GoGit) Clone ¶
Clone takes the given GitRepo reference and clones the repo with its internal implementation.
func (*GoGit) CurrentReference ¶ added in v0.0.53
func (*GoGit) EnsureCommit ¶ added in v0.0.47
func (*GoGit) FetchNonExistingBranch ¶ added in v0.0.54
type TagName ¶ added in v0.0.47
type TagName string
func (TagName) TagInLocal ¶ added in v0.0.47
func (b TagName) TagInLocal() plumbing.ReferenceName
func (TagName) TagInRemote ¶ added in v0.0.47
func (b TagName) TagInRemote() plumbing.ReferenceName
Click to show internal directories.
Click to hide internal directories.