Documentation
¶
Index ¶
Constants ¶
const Unspecified = "unspecified"
Variables ¶
This section is empty.
Functions ¶
func ProjectVersion ¶
ProjectVersion returns the version string for the git repository that the provided directory is in. The output is the output of "git describe --tags --first-parent" followed by ".dirty" if the repository currently has any uncommitted changes (including untracked files) as determined by "git status --porcelain". If the "git describe" output includes a trailing commit hash ("-g[0-9a-f]+", where [0-9a-f]+ is the commit hash), then the commit hash will be 7 characters long even if the "git describe" operation returns a longer hash. If the output starts with the character 'v' followed by a digit (0-9), then the leading 'v' is trimmed. Returns "unspecified" if the current commit cannot be described.
func ProjectVersionWithPrefix ¶
ProjectVersionWithPrefix works in the same manner as ProjectVersion, but only matches tags that begin with the provided tagPrefix. This can be useful in scenarios where a single repository contains multiple projects and tag prefixes (such as "@org/product@") are used to distinguish between releases of different products. The returned version includes the prefix.
func RepoOrigin ¶ added in v1.1.0
RepoOrigin returns the origin remote of the Git repository containing dir and its HTTPS web URL. Git failures or an empty origin return empty strings. If parsing fails, only the raw remote is returned. Local paths are converted using the same URL rules as other remotes, without requiring a host.
Types ¶
This section is empty.