Documentation
¶
Index ¶
- Constants
- Variables
- func CheckoutRef(repo *git.Repository, refName string) error
- func CloneExisting(_ context.Context, path, _ string) (*git.Repository, error)
- func CloneNonExisting(ctx context.Context, path, url string) (*git.Repository, error)
- func GetHash(repo *git.Repository, refName string) (*plumbing.Hash, error)
- func IsGitRepo(path string) bool
- func IsPartOfGitRepo(path string) (string, bool)
- func Open(ctx context.Context, path string, url, refName string) (*git.Repository, *object.Commit, error)
- func ResolveToCommit(repo *git.Repository, refName string) (*object.Commit, error)
- type BranchName
- 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 ¶
func CheckoutRef ¶ added in v0.0.3
CheckoutRef checks out a specific ref
func CloneExisting ¶ added in v0.0.3
func CloneNonExisting ¶ added in v0.0.3
func GetHash ¶ added in v0.0.3
resolveToCommit takes a repository and a reference name (tag or commit hash) and resolves it to a commit object
func IsPartOfGitRepo ¶
IsPartOfGitRepo returns the path of the repo and a boolean to indicate if the path is part of a git repo
Types ¶
type BranchName ¶
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 ¶
func (b BranchName) BranchInLocal() plumbing.ReferenceName
func (BranchName) BranchInRemote ¶
func (b BranchName) BranchInRemote() plumbing.ReferenceName
type TagName ¶
type TagName string
func (TagName) TagInLocal ¶
func (b TagName) TagInLocal() plumbing.ReferenceName
func (TagName) TagInRemote ¶
func (b TagName) TagInRemote() plumbing.ReferenceName
Click to show internal directories.
Click to hide internal directories.