git

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StatNoPorcelain = StatFlags(1 << iota) // exclude the `--porcelain` flag from `git status` query
)

Variables

View Source
var ErrNoTags = errors.New("repository has no tags (git describe failed)")
View Source
var ErrNotInsideWorktree = errors.New("dir is outside of git worktree")

Functions

This section is empty.

Types

type Description added in v0.0.2

type Description struct {
	Tag               string
	AdditionalCommits int // number of additional commits after the last tag
	ShortHash         string
}

Description contains the results of parsing the git describe output

func ParseDescription added in v0.0.2

func ParseDescription(s string) (*Description, error)

ParseDescription parses the result of `git describe --long`

type StatFlags added in v0.6.0

type StatFlags int

type Stats

type Stats struct {
	Branch      string      // result of `git branch --show-current`
	Description Description // result of `git describe --long` command
	Hash        string      // result of `git rev-parse HEAD` command
	ShortHash   string      // result of `git rev-parse --short HEAD` command
	AuthorDate  string      // result of `git log -n1 --date=format:"%Y-%m-%dT%H:%M:%S" --format=%ad`
	Dirty       bool        // repo returns non-empty `git status --porcelain`
}

Stats contains a set of git statistics

func Stat

func Stat(dir string, flags ...StatFlags) (*Stats, error)

Stat obtains git stats for a specified local directory

type VersionInfo added in v0.0.3

type VersionInfo struct {
	SemanticTag       version.Semantic // as parsed from tag
	Semantic          version.Semantic // with additional commits, if != 0
	AdditionalCommits int
	Quad              version.Quad
	Pre               string // semantic pre-release suffix
	Build             string // semantic build suffix
}

VersionInfo contains version information in various formats

func LastSemanticTag added in v0.3.0

func LastSemanticTag(dir string) (string, *VersionInfo, error)

func ParseVersion added in v0.0.3

func ParseVersion(d Description) (*VersionInfo, error)

ParseVersion extracts useful version info from git.Stat description

Jump to

Keyboard shortcuts

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