git

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: MIT Imports: 7 Imported by: 0

README

go-git

Helper functions for git implemented in Golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGitVersion

func GetGitVersion() (*semver.Version, error)

func IsValidCommitHash added in v0.1.9

func IsValidCommitHash(hash string) bool

func MustGetGitVersion

func MustGetGitVersion() *semver.Version

Types

type Branch

type Branch interface {
	GetName() string
	GetFullName() string // including remote if applicable
	GetHeadCommit() (*Commit, error)
	IsMainBranch() (bool, error)
	IsMergedTo(target Branch) (bool, error)
	Delete() error
	String() string
}

type Commit

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

func (*Commit) Equals

func (c *Commit) Equals(otherCommit *Commit) bool

func (*Commit) EqualsPatchId added in v0.1.9

func (c *Commit) EqualsPatchId(otherCommit *Commit) (bool, error)

func (*Commit) GetAuthorDate

func (c *Commit) GetAuthorDate() (time.Time, error)

func (*Commit) GetAuthorDateRelative

func (c *Commit) GetAuthorDateRelative() (string, error)

func (*Commit) GetAuthorEmail

func (c *Commit) GetAuthorEmail() (string, error)

func (*Commit) GetAuthorName

func (c *Commit) GetAuthorName() (string, error)

func (*Commit) GetBody

func (c *Commit) GetBody() (string, error)

func (*Commit) GetFullHash added in v0.1.1

func (c *Commit) GetFullHash() (string, error)

func (*Commit) GetHash

func (c *Commit) GetHash() string

func (*Commit) GetLocalBranches added in v0.1.2

func (c *Commit) GetLocalBranches() ([]*LocalBranch, error)

GetLocalBranches returns a list of all local branches containing this commit

func (*Commit) GetMessage

func (c *Commit) GetMessage() (string, error)

func (*Commit) GetPatchId added in v0.1.9

func (c *Commit) GetPatchId() (string, error)

func (*Commit) GetRemoteBranches added in v0.1.8

func (c *Commit) GetRemoteBranches(remote *Remote) ([]*RemoteBranch, error)

GetRemoteBranches returns a list of all branches on a given remote containing this commit

func (*Commit) GetShortHash added in v0.1.1

func (c *Commit) GetShortHash() (string, error)

func (*Commit) String

func (c *Commit) String() string

type LocalBranch

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

func (*LocalBranch) Delete

func (b *LocalBranch) Delete() error

func (*LocalBranch) Equals

func (b *LocalBranch) Equals(otherLocalBranch *LocalBranch) bool

func (*LocalBranch) ForceDelete added in v0.1.9

func (b *LocalBranch) ForceDelete() error

func (*LocalBranch) GetCommitsByMessage added in v0.1.9

func (b *LocalBranch) GetCommitsByMessage(msg string) ([]*Commit, error)

func (*LocalBranch) GetFullName

func (b *LocalBranch) GetFullName() string

func (*LocalBranch) GetHeadCommit

func (b *LocalBranch) GetHeadCommit() (*Commit, error)

func (*LocalBranch) GetName

func (b *LocalBranch) GetName() string

func (*LocalBranch) GetTrackingRemote

func (b *LocalBranch) GetTrackingRemote(r *Remote) (*RemoteBranch, error)

func (*LocalBranch) IsMainBranch

func (b *LocalBranch) IsMainBranch() (bool, error)

func (*LocalBranch) IsMergedTo

func (b *LocalBranch) IsMergedTo(target Branch) (bool, error)

func (*LocalBranch) String

func (b *LocalBranch) String() string

type Remote

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

func (*Remote) GetBranch

func (r *Remote) GetBranch(name string) (*RemoteBranch, error)

func (*Remote) GetBranches

func (r *Remote) GetBranches() ([]*RemoteBranch, error)

func (*Remote) GetMainBranch added in v0.1.4

func (r *Remote) GetMainBranch() (*RemoteBranch, error)

func (*Remote) GetName

func (r *Remote) GetName() string

func (*Remote) HasBranch

func (r *Remote) HasBranch(name string) (bool, error)

func (*Remote) String

func (r *Remote) String() string

type RemoteBranch

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

func (*RemoteBranch) Delete added in v0.1.7

func (b *RemoteBranch) Delete() error

func (*RemoteBranch) Equals added in v0.1.6

func (b *RemoteBranch) Equals(otherRemoteBranch *RemoteBranch) bool

func (*RemoteBranch) GetFullName

func (b *RemoteBranch) GetFullName() string

func (*RemoteBranch) GetHeadCommit

func (r *RemoteBranch) GetHeadCommit() (*Commit, error)

func (*RemoteBranch) GetName

func (b *RemoteBranch) GetName() string

func (*RemoteBranch) IsMergedTo

func (b *RemoteBranch) IsMergedTo(target *RemoteBranch) (bool, error)

func (*RemoteBranch) String

func (b *RemoteBranch) String() string

type Repository

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

func OpenRepository

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

func (*Repository) Execute

func (r *Repository) Execute(c script.Command) (pr *script.ProcessResult, err error)

func (*Repository) GetBranch

func (r *Repository) GetBranch(name string) (*LocalBranch, error)

func (*Repository) GetBranches

func (r *Repository) GetBranches() ([]*LocalBranch, error)

func (*Repository) GetCurrentBranch

func (r *Repository) GetCurrentBranch() (*LocalBranch, error)

func (*Repository) GetCurrentCommit

func (r *Repository) GetCurrentCommit() (Commit, error)

func (*Repository) GetMainBranch

func (r *Repository) GetMainBranch() (*LocalBranch, error)

func (*Repository) GetPath

func (r *Repository) GetPath() string

func (*Repository) GetRemote

func (r *Repository) GetRemote(name string) (*Remote, error)

func (*Repository) GetRemotes

func (r *Repository) GetRemotes() ([]*Remote, error)

func (*Repository) HasBranch

func (r *Repository) HasBranch(name string) (bool, error)

func (*Repository) HasRemote

func (r *Repository) HasRemote(name string) (bool, error)

func (*Repository) String

func (r *Repository) String() string

Jump to

Keyboard shortcuts

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