git

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Overview

The git package contains functions for running git commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	SourceName string
	DestName   string
	Action     string
	SourceMode string
	DestMode   string
	SourceSHA  string
	DestSHA    string
}

type Commit

type Commit struct {
	commit.Commit
	Hash    string
	Changes []Change
}

Commit represents a commit in a git repository.

type Repository

type Repository struct {
	GitDir string
	Path   string
	// contains filtered or unexported fields
}

Repository represents a git repository.

func New

func New(path string) (*Repository, error)

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

func (*Repository) CreateTag

func (r *Repository) CreateTag(hash, name, message string, signed bool) error

CreateTag tags a commit in a git repo.

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

func (*Repository) DeleteTags

func (r *Repository) DeleteTags(tags []string) error

func (*Repository) Head

func (r *Repository) Head() (c Commit, err error)

Head returns the commit at HEAD

func (*Repository) IsDirty added in v0.7.0

func (r *Repository) IsDirty() (bool, error)

IsDirty returns a boolean indicating whether there are uncommited changes.

func (*Repository) PushTag

func (r *Repository) PushTag(tag string, remote string) error

PushTag pushes tag to remote.

func (*Repository) PushTags

func (r *Repository) PushTags(tags []string, remote string) error

PushTags pushes tags to the remote repository remote.

func (*Repository) RevList

func (r *Repository) RevList(start, end string, paths ...string) ([]Commit, error)

RevList returns a slice of commits from start to end.

func (*Repository) RevParse

func (r *Repository) RevParse(rev string) (string, error)

func (*Repository) SetLogger added in v0.9.0

func (r *Repository) SetLogger(l logr.Logger)

SetLogger updates the Repository's internal logger.

func (*Repository) Tags

func (r *Repository) Tags(rev string, prefixes ...string) (tags []string, err error)

Tags returns all tags that point to ancestors of rev.

rev can be either a revision or a hash.

prefix is a string prefix to filter tags with.

Jump to

Keyboard shortcuts

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