git

package
v0.0.0-...-ca41431 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause Imports: 14 Imported by: 3

Documentation

Overview

Package git implements a git backend for the vcs interface.

This package aims to be a pure-Go implementation, but it's currently using a fallback to the gitcmd backend for some of the missing features. See repo_fallback.go for the list of fallback functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	*gitcmd.Repository
	// contains filtered or unexported fields
}

Repository is a git VCS repository.

This implementation does not provide any locking. Concurrency concerns should be handled by the consumer of this library.

func Clone

func Clone(url, dir string, opt vcs.CloneOpt) (*Repository, error)

func Open

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

func (*Repository) Branches

func (r *Repository) Branches(opt vcs.BranchesOptions) ([]*vcs.Branch, error)

Branches returns a list of all branches in the repository.

func (*Repository) Close

func (r *Repository) Close() error

func (*Repository) Commits

func (r *Repository) Commits(opt vcs.CommitsOptions) ([]*vcs.Commit, uint, error)

Commits returns all commits matching the options, as well as the total number of commits (the count of which is not subject to the N/Skip options).

Optionally, the caller can request the total not to be computed, as this can be expensive for large branches.

func (*Repository) FileSystem

func (r *Repository) FileSystem(at vcs.CommitID) (vfs.FileSystem, error)

FileSystem opens the repository file tree at a given commit ID.

func (*Repository) GetCommit

func (r *Repository) GetCommit(commitID vcs.CommitID) (*vcs.Commit, error)

GetCommit returns the commit with the given commit ID, or ErrCommitNotFound if no such commit exists.

func (*Repository) ResolveBranch

func (r *Repository) ResolveBranch(name string) (vcs.CommitID, error)

ResolveBranch returns the branch with the given name, or ErrBranchNotFound if no such branch exists.

func (*Repository) ResolveRevision

func (r *Repository) ResolveRevision(spec string) (vcs.CommitID, error)

ResolveRevision returns the revision that the given revision specifier resolves to, or a non-nil error if there is no such revision.

func (*Repository) ResolveTag

func (r *Repository) ResolveTag(name string) (vcs.CommitID, error)

ResolveTag returns the tag with the given name, or ErrTagNotFound if no such tag exists.

func (*Repository) Tags

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

Tags returns a list of all tags in the repository.

Jump to

Keyboard shortcuts

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