git

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitCommit = "initialise repo"
)

Variables

This section is empty.

Functions

func AnnotatedTag added in v0.6.0

func AnnotatedTag(tag string, cd CommitDetails) error

AnnotatedTag will create an annotated tag against the repository and push it to the origin

func Clean

func Clean(output string, err error) (string, error)

Clean the output

func Commit

func Commit(cd CommitDetails) error

Commit will generate a commit against the repository and push it to the origin. The commit will be associated with the provided author and email address

func EmptyCommit

func EmptyCommit(t *testing.T, commit string) string

EmptyCommit will create an empty commit without the need for modifying any existing files within the repository

func EmptyCommitAndTag

func EmptyCommitAndTag(t *testing.T, tag, msg string) string

EmptyCommitAndTag will create an empty commit with an associated tag. No existing files will be modified within the repository

func EmptyCommits

func EmptyCommits(t *testing.T, commits ...string) []string

EmptyCommits will create any number of empty commits without the need for modifying any existing files within the repository

func EmptyCommitsAndTag

func EmptyCommitsAndTag(t *testing.T, tag string, msgs ...string) []string

EmptyCommitsAndTag will create any number of empty commits and associate them with a tag. No existing files will be modified within the repository

func FetchTags added in v1.2.0

func FetchTags() error

FetchTags retrieves all tags associated with the remote repository

func InitRepo

func InitRepo(t *testing.T) string

InitRepo creates an empty git repository within a temporary directory. Once created the current testing context will operate from within that directory until the calling test has completed

func IsRepo

func IsRepo() bool

IsRepo identifies whether the current working directory is a recognised git repository

func MkTmpDir

func MkTmpDir(t *testing.T)

MkTmpDir creates an empty directory that is not a git repository. Once created the current testing context will operate from within that directory until the calling test has completed

func Push added in v0.2.0

func Push() error

Push all committed changes to the configured origin

func Run

func Run(args ...string) (string, error)

Run executes a git command and returns its output or errors

func Stage added in v0.2.0

func Stage(path string) error

Stage will ensure the specified file is staged for the next commit

func Staged added in v1.4.0

func Staged() ([]string, error)

Staged retrieves a list of all files that are currently staged

func Tag

func Tag(tag string) error

Tag will create a lightweight tag against the repository and push it to the origin

Types

type CommitDetails added in v0.4.0

type CommitDetails struct {
	Message string
	Author  string
	Email   string
}

CommitDetails contains mandatory details about a specific git commit

func LatestCommit

func LatestCommit() (CommitDetails, error)

LatestCommit retrieves the latest commit within the repository

func (CommitDetails) String added in v0.4.0

func (c CommitDetails) String() string

String prints out a user friendly string representation

type LogEntry added in v1.4.0

type LogEntry struct {
	Hash       string
	AbbrevHash string
	Message    string
}

LogEntry contains details about a specific git log entry

func LogBetween added in v1.4.0

func LogBetween(from, to string, excludes []string) ([]LogEntry, error)

LogBetween retrieves all log entries between two points of time within the git history of the repository. Supports tags and specific git hashes as its reference points. From must always be the closest point to HEAD

type TagEntry added in v1.13.0

type TagEntry struct {
	Ref     string
	Created string
}

TagEntry contains details about a specific tag

func AllTags added in v1.4.0

func AllTags() []TagEntry

AllTags retrieves all tags within the repository from newest to oldest

func DescribeTag added in v1.13.0

func DescribeTag(ref string) TagEntry

DescribeTag retrieves details about a specific tag

func LatestTag

func LatestTag() TagEntry

LatestTag retrieves the latest tag within the repository

Jump to

Keyboard shortcuts

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