git

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Description

type Description struct {
	// contains filtered or unexported fields
}

Description describes the state of a git repository.

func Describe

func Describe(path string) (*Description, error)

Describe returns a description of HEAD of the git repository at path.

func (*Description) CommitHash

func (d *Description) CommitHash() string

CommitHash returns the hash of the commit described by d.

func (*Description) CommitTime

func (d *Description) CommitTime() time.Time

CommitTime returns the time of the commit described by d.

func (*Description) IsClean

func (d *Description) IsClean() bool

IsClean returns true if the git working tree has local modifications.

func (*Description) Version

func (d *Description) Version() (semver.Version, error)

Version returns a semantic version based on d. If d is tagged directly, the parsed version is returned. Otherwise, a version is derived that preserves semantic precedence.

For example:

  • If d.tag.Name = "v0.1.2-alpha.1" and d.n = 1, 0.1.2-alpha.1.0.devel.1 is returned.
  • If d.tag.Name = "v0.1.2" and d.n = 1, 0.1.3-0.devel.1 is returned.
  • If d.tag.Name = "v0.1.3" and d.n = 0, 0.1.3 is returned.

Jump to

Keyboard shortcuts

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