Documentation
¶
Index ¶
- Variables
- func GetCurrentBranch() (string, error)
- func GetHeadHash() (sha string, err error)
- func GetHeadHashShort() (sha string, err error)
- func GetLatestTag() (string, error)
- func GetLatestTagFromLocal() (tag string, err error)
- func GetLatestTagFromRemote() (tag string, err error)
- func GetRemoteURL() (string, error)
- func GetTagCommitSha(tag string) (sha string, err error)
- func GetTagCommitShaFromLocal(tag string) (sha string, err error)
- func GetTagCommitShaFromRemote(_ string) (string, error)
- func GetTagList() (tags []string, err error)
- func GetTagListFromRemote(remoteURL string, reverse bool) (tags []string, err error)
- func IsDirty() (dirty bool, err error)
- func IsHeadAtTag(tag string) (bool, error)
- type GitInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyGitTag = errors.New("empty tag")
Functions ¶
func GetCurrentBranch ¶
func GetHeadHash ¶
func GetHeadHashShort ¶
func GetLatestTag ¶
func GetLatestTagFromLocal ¶
func GetLatestTagFromRemote ¶
get latest tag from remote, the fitting git clone depth is 1
func GetTagCommitSha ¶
func GetTagCommitShaFromRemote ¶
get tag commit sha from remote, the fitting git clone depth is 1
func GetTagList ¶
func GetTagListFromRemote ¶
func IsHeadAtTag ¶
Types ¶
type GitInfo ¶
type GitInfo struct { CurrentBranch string `json:"currentBranch,omitempty" yaml:"currentBranch,omitempty"` // Such as "master" HeadCommit string `json:"headCommit,omitempty" yaml:"headCommit,omitempty"` // Such as "3836f8770ab8f488356b2129f42f2ae5c1134bb0" TreeState string `json:"treeState,omitempty" yaml:"treeState,omitempty"` // Such as "clean", "dirty" LatestTag string `json:"latestTag,omitempty" yaml:"latestTag,omitempty"` // Such as "v1.2.3" }
GitInfo contains git information.
func NewGitInfoFrom ¶
NewGitInfoFrom returns git info from workDir, or nil if failed.
Click to show internal directories.
Click to hide internal directories.