gitutil

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Owner = "KusionStack"
	Repo  = "kusion"
)

Variables

View Source
var ErrEmptyGitTag = errors.New("empty tag")

Functions

func GetCurrentBranch

func GetCurrentBranch() (string, error)

func GetHeadHash

func GetHeadHash() (sha string, err error)

func GetHeadHashShort

func GetHeadHashShort() (sha string, err error)

func GetLatestTag

func GetLatestTag() (string, error)

func IsDirty

func IsDirty() (dirty bool, err error)

func IsHeadAtTag

func IsHeadAtTag(tag string) (bool, error)

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

func NewGitInfoFrom(workDir string) (*GitInfo, error)

NewGitInfoFrom returns git info from workDir, or nil if failed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL