git

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DescVersion

type DescVersion struct {
	LastTag           string
	AdditionalCommits string // number of additional commits after the last tag
	Numeric           string
	Quad              ver.Quad // semantic version extracted from tag: "0.1.2.3"
	Combined          string
}

DescVersion contains the results of parsing the git describe output with RetrieveSemanticVersionV4 (see below)

type Stats

type Stats struct {
	Branch     string // result of `git branch --show-current`
	Describe   string // 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`
}

Stats contains a set of git statistics

func Stat

func Stat(dir string) (*Stats, error)

Stat obtains git stats for a specified local directory

func (*Stats) RetrieveSemanticVersionV4

func (s *Stats) RetrieveSemanticVersionV4() (*DescVersion, error)

RetrieveSemanticVersionV4 parses the result of git describe and extracts the application version number assuming the repo is tagged with v1.2.3.4 tags. If the repo had evolved since the last tag, the git describe adds a suffix in a -<nsteps>-<hash> form that is reported in the Suffix field of the returned struct

Jump to

Keyboard shortcuts

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