git

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

The git package contains functions for running git commands.

This package is deprecated and will be removed before the v1.0.0 release of gotagger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Hash     string            // The commit hash
	Subject  string            // The commit subject, generally the first line of the commit message
	Body     string            // The commit body
	Tags     []*semver.Version // All tags that point to this commit.
	Trailers []string          // The commit trailers
}

Commit represents a commit in a git repository.

type Repo

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

Repo represents a git repository.

func New

func New(path string) (Repo, error)

New returns a new git Repo. If path is not a git repo, then an error will be returned.

func (Repo) CreateTag

func (r Repo) CreateTag(commit string, v *semver.Version, prefix, message string, signed bool) error

CreateTag tags a commit in a git repo.

If signed is true, then the tag will be a signed tag. This requires that your git configuration is properly setup for signing.

If prefix is a non-empty string, then the version will be prefixed with that string.

func (Repo) Head

func (r Repo) Head() (Commit, error)

Head returns the commit at HEAD

func (Repo) PushTag

func (r Repo) PushTag(tag *semver.Version, repo string) error

PushTag pushes tag to the remote repository repo.

func (Repo) RevList

func (r Repo) RevList(start, end string) ([]Commit, error)

RevList returns a slice of commits from start to end.

func (Repo) Tags

func (r Repo) Tags(prefixes ...string) (commits []Commit, err error)

Tags returns a slice of all tagged commits.

Jump to

Keyboard shortcuts

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