Documentation ¶
Index ¶
- Constants
- func EnsureGitIsFromCIPD(ctx context.Context) error
- func FindGit(ctx context.Context) (string, int, int, error)
- func IsFromCIPD(git string) bool
- func MocksForFindGit(ctx context.Context, cmd *exec.Command) error
- func Version(ctx context.Context, git string) (int, int, error)
- func WithGitFinder(ctx context.Context, finder func() (string, error)) context.Context
Constants ¶
const ( // Apps will gradually migrate to using MainBranch instead of // MasterBranch as more repositories use MainBranch (skbug.com/11842). MasterBranch = "master" MainBranch = "main" // DefaultRef is the fully-qualified ref name of the default branch for most // repositories. DefaultRef = RefsHeadsPrefix + MainBranch // DefaultRemote is the name of the default remote repository. DefaultRemote = "origin" // DefaultRemoteBranch is the name of the default branch in the default // remote repository, for most repos. DefaultRemoteBranch = DefaultRemote + "/" + MainBranch // RefsHeadsPrefix is the "refs/heads/" prefix used for branches. RefsHeadsPrefix = "refs/heads/" )
Variables ¶
This section is empty.
Functions ¶
func EnsureGitIsFromCIPD ¶
EnsureGitIsFromCIPD returns an error if the version of Git in PATH does not appear to be obtained via CIPD.
func FindGit ¶
FindGit returns the path to the Git executable and the major and minor version numbers, or any error which occurred.
func IsFromCIPD ¶
IsFromCIPD returns a bool indicating whether or not the given version of Git appears to be obtained via CIPD.
func MocksForFindGit ¶
MocksForFindGit returns a DelegateRun func which can be passed to exec.CommandCollector.SetDelegateRun so that FindGit will succeed when calls to exec are fully mocked out.
func Version ¶
Version returns the installed Git version, in the form: (major, minor), or an error if it could not be determined.
func WithGitFinder ¶
WithGitFinder overrides how the git_common.FindGit() function locates the git executable. By default, it looks on the PATH, but this can allow other behavior. The primary case is tests, where we load in a hermetic version of git.
Types ¶
This section is empty.