git

package
v0.0.0-...-e3bfcd1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Description

func Description(path string) string

Description returns the description of that repository at path, if it was altered.

Types

type Git

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

Git holds basic repository data

func Use

func Use(path string, rev string) (*Git, error)

Use allows access to a git repository at path with rev as revision.

func (*Git) Blame

func (r *Git) Blame(file string) (string, error)

Blame returns the file content with commit metadata per line.

func (*Git) Branches

func (r *Git) Branches() ([]*plumbing.Reference, error)

Branches returns a list of all available branches.

func (*Git) ByteContent

func (r *Git) ByteContent(path string) ([]byte, error)

ByteContent returns the content of path.

func (*Git) Commits

func (r *Git) Commits() ([]*object.Commit, error)

Commits returns all commits of that related git repository.

func (*Git) Description

func (r *Git) Description() string

Description returns the description of the related git repository, if it was altered.

func (*Git) FileContent

func (r *Git) FileContent(path string) (string, bool, error)

FileContent returns the contant of path if it is not a binary type.

func (*Git) FileTree

func (r *Git) FileTree() (*object.Tree, error)

FileTree returns all files in that revision of that related git repository.

func (*Git) Head

func (r *Git) Head() string

Head returns the hash of the revisions HEAD as a string.

func (*Git) LastCommit

func (r *Git) LastCommit() (*object.Commit, error)

LastCommit returns the last commit in that revision of that related git repository.

func (*Git) Patch

func (r *Git) Patch(ctx context.Context, commit *object.Commit) (string, error)

Patch creates a patch within ctx from commit to parent.

func (*Git) PrimaryBranch

func (r *Git) PrimaryBranch() (*plumbing.Reference, error)

PrimaryBranch returns either main/master or the first branch available.

func (*Git) Tags

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

Tags returns a list of all annotated tags.

Jump to

Keyboard shortcuts

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