Documentation ¶
Overview ¶
Package vcs provides helper functions for working with various repositories (e.g. git).
Index ¶
- Constants
- func CanonicalizeCommit(title string) string
- func CheckBranch(branch string) bool
- func CheckCommitHash(hash string) bool
- func CheckRepoAddress(repo string) bool
- func CommitLink(url, hash string) string
- func LogLink(url, hash string) string
- func Patch(dir string, patch []byte) error
- func TreeLink(url, hash string) string
- type BisectEnv
- type BisectResult
- type Bisecter
- type Commit
- type Repo
Constants ¶
View Source
const SyzkallerRepo = "https://github.com/google/syzkaller"
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeCommit ¶
CanonicalizeCommit returns commit title that can be used when checking if a particular commit is present in a git tree. Some trees add prefixes to commit titles during backporting, so we want e.g. commit "foo bar" match "BACKPORT: foo bar".
func CheckBranch ¶
CheckBranch does a best-effort approximate check of a git branch name.
func CheckCommitHash ¶
func CheckRepoAddress ¶
CheckRepoAddress does a best-effort approximate check of a git repo address.
func CommitLink ¶
Types ¶
type BisectResult ¶
type BisectResult int
const ( BisectBad BisectResult = iota BisectGood BisectSkip )
type Bisecter ¶
type Bisecter interface { // Bisect bisects good..bad commit range against the provided predicate (wrapper around git bisect). // The predicate should return an error only if there is no way to proceed // (it will abort the process), if possible it should prefer to return BisectSkip. // Progress of the process is streamed to the provided trace. // Returns the first commit on which the predicate returns BisectBad, // or multiple commits if bisection is inconclusive due to BisectSkip. Bisect(bad, good string, trace io.Writer, pred func() (BisectResult, error)) ([]*Commit, error) // PreviousReleaseTags returns list of preceding release tags that are reachable from the given commit. PreviousReleaseTags(commit string) ([]string, error) EnvForCommit(commit string, kernelConfig []byte) (*BisectEnv, error) }
Bisecter may be optionally implemented by Repo.
type Repo ¶
type Repo interface { // Poll checkouts the specified repository/branch. // This involves fetching/resetting/cloning as necessary to recover from all possible problems. // Returns hash of the HEAD commit in the specified branch. Poll(repo, branch string) (*Commit, error) // CheckoutBranch checkouts the specified repository/branch. CheckoutBranch(repo, branch string) (*Commit, error) // CheckoutCommit checkouts the specified repository on the specified commit. CheckoutCommit(repo, commit string) (*Commit, error) // SwitchCommit checkouts the specified commit without fetching. SwitchCommit(commit string) (*Commit, error) // HeadCommit returns info about the HEAD commit of the current branch of git repository. HeadCommit() (*Commit, error) // GetCommitByTitle finds commit info by the title. // Remote is not fetched, the commit needs to be reachable from the current repo state // (e.g. do CheckoutBranch before). If the commit is not found, nil is returned. GetCommitByTitle(title string) (*Commit, error) // GetCommitsByTitles is a batch version of GetCommitByTitle. // Returns list of commits and titles of commits that are not found. GetCommitsByTitles(titles []string) ([]*Commit, []string, error) // ListRecentCommits returns list of recent commit titles starting from baseCommit. ListRecentCommits(baseCommit string) ([]string, error) // ExtractFixTagsFromCommits extracts fixing tags for bugs from git log. // Given email = "user@domain.com", it searches for tags of the form "user+tag@domain.com" // and returns commits with these tags. ExtractFixTagsFromCommits(baseCommit, email string) ([]*Commit, error) }
func NewSyzkallerRepo ¶
Click to show internal directories.
Click to hide internal directories.