gitutil

package
v0.0.0-...-c0cdbda Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Ref    *plumbing.Reference
	Commit *object.Commit
}

Branch stores its own reference and commit data.

type Diff

type Diff struct {
	From    *object.Commit
	To      *object.Commit
	Changes object.Changes
}

Diff stores a git patch that contains the difference between two commits.

type Repository

type Repository struct {
	Git  *git.Repository
	Name string
	Desc string
}

Repository is a wrapper for go-git's Repository type.

func Open

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

Open returns a git repository from the given path.

func (*Repository) Branches

func (r *Repository) Branches() ([]*Branch, error)

Branches returns all branches sorted from the recently updated branch.

func (*Repository) DefaultRef

func (r *Repository) DefaultRef() string

DefaultRef returns the reference name pointed to by HEAD, or else an empty string if not found.

func (*Repository) Diff

func (r *Repository) Diff(ref string) (*Diff, error)

Diff returns the difference between the specified reference and its parent. If the parent does not exist, the patch will only have the add operation.

func (*Repository) Log

func (r *Repository) Log(n int, options *git.LogOptions) ([]*object.Commit, error)

Log returns at most n commits or all of them if n < 0 with the given options. If there are no more commits, io.EOF is returned along with the list.

func (*Repository) RevCommit

func (r *Repository) RevCommit(ref string) (*object.Commit, error)

RevCommit returns the commit object from the given revision.

func (*Repository) Tags

func (r *Repository) Tags() ([]*object.Tag, error)

Tags returns all annotated tags sorted from the recently created tag.

func (*Repository) Updated

func (r *Repository) Updated() time.Time

Updated returns the time of the latest commit.

Jump to

Keyboard shortcuts

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