Documentation ¶
Index ¶
- func Clone(ctx context.Context, remote, version, outDir string) error
- func CurrentSHA(ctx context.Context, dir string) (string, error)
- func HeadTags(ctx context.Context, dir string) ([]string, error)
- func IsClean(ctx context.Context, dir string) (bool, error)
- func ParseSemverTag(t string) (*semver.Version, error)
- func RemoteTags(ctx context.Context, remote string) ([]string, error)
- func Workspace(ctx context.Context, path string) (string, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
Clone checks out the given branch, tag or long commit SHA from the given repo. It uses the git CLI already installed on the system.
To optimize storage and bandwidth, the full git history is not fetched.
"remote" may be any format accepted by git, such as https://github.com/abcxyz/abc.git or git@github.com:abcxyz/abc.git .
func CurrentSHA ¶ added in v0.5.0
CurrentSHA returns the full SHA of the current HEAD in the given git workspace.
func HeadTags ¶ added in v0.5.0
HeadTags looks at a local git workspace and returns the names of all tags that point to the current HEAD commit. If there are no such tags, returns empty slice, this is not an error.
func IsClean ¶ added in v0.5.0
IsClean returns false if the given git workspace has any uncommitted changes, and otherwise returns true. Returns error if dir is not in a git workspace.
func ParseSemverTag ¶ added in v0.4.0
ParseSemverTag parses a string of the form "v1.2.3" into a semver tag. In abc CLI, we require that tags begin with "v", and anything else is a parse error.
WARNING: the returned semver.Version has had the "v" prefix stripped, so the string returned from .Original() will be missing the "v".
func RemoteTags ¶ added in v0.5.0
RemoteTags looks up the tags in the given remote repo. If there are no tags, that's not an error, and the returned slice is len 0.
"remote" may be any format accepted by git, such as https://github.com/abcxyz/abc.git or git@github.com:abcxyz/abc.git .
func Workspace ¶ added in v0.4.0
Workspace looks for the presence of a .git directory in parent directories to determine the root directory of the git workspace containing "path". Returns false if the given path is not inside a git workspace.
The input path need not actually exist yet. For example, suppose "/a/b" is a git workspace, which means that "/a/b/.git" is a directory that exists. Calling Workspace("/a/b/c") will return "/a/b" whether or not "c" actually exists yet. This supports the case where the user is rendering into a directory that doesn't exist yet but will be created by the render operation.
Types ¶
This section is empty.