git

package
v2.2.9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	Client *git.Repository

	Path     string
	Remote   string
	MaxDepth int
	// contains filtered or unexported fields
}

func New

func New(
	path, url, token, remote, defaultBranch string, maxDepth int, logLvl log.Level,
) (repo Repository, err error)

New registers a new git repository. If there is a git repository already present in "path", the url and remote will be validated and then the repository will be used.

func (*Repository) Checkout

func (r *Repository) Checkout(branch string, force bool) (res *Tree, err error)

type Tree

type Tree struct {
	RepoClient *git.Repository
	T          *object.Tree
	HeadCommit *object.Commit
}

func (*Tree) DiffPaths

func (t *Tree) DiffPaths(c *Tree) ([]string, error)

Diff compares the provided GitTree c with g and returns a slice of changed file paths.

func (*Tree) FindFiles

func (t *Tree) FindFiles(pattern string) (files []string, err error)

FindFiles searches t for all instances of the provided pattern in the file paths.

func (*Tree) MergeBase

func (t *Tree) MergeBase(other *Tree) (base *Tree, err error)

func (*Tree) ReadFile

func (t *Tree) ReadFile(filepath string) (string, error)

ReadFile reads the file at location filepath and returns its content as a string.

Jump to

Keyboard shortcuts

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