Documentation ¶
Overview ¶
Package git implements utility routines for operating on remote Git repositories and metadata.
Index ¶
- func NormalizeRepoTags(repoURL string, repoTagsCache RepoTagsCache) (NormalizedTags map[string]NormalizedTag, e error)
- func RefBranches(refs []*plumbing.Reference) (branches []*plumbing.Reference)
- func RefTags(refs []*plumbing.Reference) (tags []*plumbing.Reference)
- func RemoteRepoRefsWithRetry(repoURL string, retries uint64) (refs []*plumbing.Reference, err error)
- func RepoName(repoURL string) (name string, e error)
- func ValidRepo(repoURL string) (valid bool)
- func ValidRepoAndHasUsableRefs(repoURL string) (valid bool)
- func VersionToCommit(version string, repo string, commitType cves.CommitType, ...) (ac cves.AffectedCommit, e error)
- type NormalizedTag
- type RepoTagsCache
- type RepoTagsMap
- type Tag
- type Tags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeRepoTags ¶
func NormalizeRepoTags(repoURL string, repoTagsCache RepoTagsCache) (NormalizedTags map[string]NormalizedTag, e error)
NormalizeRepoTags returns a map of normalized tags mapping back to original tags and also commit hashes. An optional repoTagsCache can be supplied to reduce repeated remote connections to the same repo.
func RefBranches ¶
Return a list of just the references that are branches.
func RemoteRepoRefsWithRetry ¶
func RemoteRepoRefsWithRetry(repoURL string, retries uint64) (refs []*plumbing.Reference, err error)
RemoteRepoRefsWithRetry will exponentially retry listing the peeled references of the repoURL up to retries times.
func ValidRepoAndHasUsableRefs ¶
Otherwise functional repos that don't have any tags are not valid.
func VersionToCommit ¶
func VersionToCommit(version string, repo string, commitType cves.CommitType, normalizedTags map[string]NormalizedTag) (ac cves.AffectedCommit, e error)
Take an unnormalized version string, a repo, the pre-normalized mapping of tags to commits and return an AffectedCommit.
Types ¶
type NormalizedTag ¶
NormalizedTag holds a normalized (as by NormalizeRepoTags) tag and corresponding commit hash.
type RepoTagsCache ¶
type RepoTagsCache map[string]RepoTagsMap
RepoTags acts as a cache for RepoTags results, keyed on the repo's URL.
type RepoTagsMap ¶
type RepoTagsMap struct { Tag map[string]Tag // The key is the original tag as seen on the repo. NormalizedTag map[string]NormalizedTag // The key is the normalized (as by NormalizeRepoTags) original tag. }
RepoTagsMap holds all of the tags (naturally occurring and normalized) for a Git repo.
type Tags ¶
type Tags []Tag
func RepoTags ¶
func RepoTags(repoURL string, repoTagsCache RepoTagsCache) (tags Tags, e error)
RepoTags returns an array of Tag being the (unpeeled, if annotated) tags and associated commits in repoURL. An optional repoTagsCache can be supplied to reduce repeated remote connections to the same repo.