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 ¶
- type Repository
- func (r *Repository) Branches(opt vcs.BranchesOptions) ([]*vcs.Branch, error)
- func (r *Repository) Close() error
- func (r *Repository) Commits(opt vcs.CommitsOptions) ([]*vcs.Commit, uint, error)
- func (r *Repository) FileSystem(at vcs.CommitID) (vfs.FileSystem, error)
- func (r *Repository) GetCommit(commitID vcs.CommitID) (*vcs.Commit, error)
- func (r *Repository) ResolveBranch(name string) (vcs.CommitID, error)
- func (r *Repository) ResolveRevision(spec string) (vcs.CommitID, error)
- func (r *Repository) ResolveTag(name string) (vcs.CommitID, error)
- func (r *Repository) Tags() ([]*vcs.Tag, error)
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 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 ¶
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.