Documentation ¶
Index ¶
- func Checkout(ctx context.Context, version, workspaceDir string) error
- func Clone(ctx context.Context, remote, 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 LocalTags(ctx context.Context, tmpDir string) ([]string, error)
- func Workspace(ctx context.Context, path string) (string, bool, error)
- type NoSuchVersionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checkout ¶ added in v0.9.2
Checkout checks out the provided version (branch, tag, or SHA) from the already-cloned given git workspace. It uses the git CLI already installed on the system.
If the given version is both a valid branch name and tag name, then we'll do what "git checkout" does in that case, and check out the branch.
If the version does not exist as a branch, tag, or SHA in this repo, then *NoSuchVersionError will be returned.
func Clone ¶
Clone checks out the given repo. It uses the git CLI already installed on the system.
"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 LocalTags ¶ added in v0.9.2
LocalTags looks up the tags in the given locally cloned repo. If there are no tags, that's not an error, and the returned slice is len 0. The return values are sorted lexicographically.
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 ¶
type NoSuchVersionError ¶ added in v0.9.2
type NoSuchVersionError struct {
Version string
}
NoSuchVersionError is returned from Checkout when the requested version doesn't exist.
func (*NoSuchVersionError) Error ¶ added in v0.9.2
func (e *NoSuchVersionError) Error() string