git

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingRepo = errors.New("missing repo")

ErrMissingRepo indicates that the requested repository could not be found.

Functions

This section is empty.

Types

type Repo

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

Repo represents a Git repository.

func (*Repo) CommitsByPage added in v0.3.0

func (r *Repo) CommitsByPage(ref *git.Reference, page, size int) (git.Commits, error)

CommitsByPage returns the commits for a repository.

func (*Repo) CountCommits added in v0.3.0

func (r *Repo) CountCommits(ref *git.Reference) (int64, error)

CountCommits returns the number of commits for a repository.

func (*Repo) Diff added in v0.3.0

func (r *Repo) Diff(commit *git.Commit) (*git.Diff, error)

Diff returns the diff for a given commit.

func (*Repo) HEAD added in v0.3.0

func (r *Repo) HEAD() (*git.Reference, error)

HEAD returns the reference for a repository.

func (*Repo) LatestFile

func (r *Repo) LatestFile(pattern string) (string, string, error)

LatestFile returns the contents of the latest file at the specified path in the repository and its file path.

func (*Repo) Name

func (r *Repo) Name() string

GetName returns the name of the repository.

func (*Repo) Path added in v0.3.0

func (r *Repo) Path() string

Path returns the path to the repository.

func (*Repo) Push added in v0.3.0

func (r *Repo) Push(remote, branch string) error

Push pushes the repository to the remote.

func (*Repo) Readme

func (r *Repo) Readme() (readme string, path string)

Readme returns the readme and its path for the repository.

func (*Repo) References added in v0.3.0

func (r *Repo) References() ([]*git.Reference, error)

GetReferences returns the references for a repository.

func (*Repo) SetReadme added in v0.3.0

func (r *Repo) SetReadme(readme, path string)

SetReadme sets the readme for the repository.

func (*Repo) Tree added in v0.2.2

func (r *Repo) Tree(ref *git.Reference, path string) (*git.Tree, error)

Tree returns the git tree for a given path.

func (*Repo) UpdateServerInfo added in v0.3.0

func (r *Repo) UpdateServerInfo() error

UpdateServerInfo updates the server info for the repository.

type RepoSource

type RepoSource struct {
	Path string
	// contains filtered or unexported fields
}

RepoSource is a reference to an on-disk repositories.

func NewRepoSource

func NewRepoSource(repoPath string) *RepoSource

NewRepoSource creates a new RepoSource.

func (*RepoSource) AllRepos

func (rs *RepoSource) AllRepos() []*Repo

AllRepos returns all repositories for the given RepoSource.

func (*RepoSource) GetRepo

func (rs *RepoSource) GetRepo(name string) (*Repo, error)

GetRepo returns a repository by name.

func (*RepoSource) InitRepo

func (rs *RepoSource) InitRepo(name string, bare bool) (*Repo, error)

InitRepo initializes a new Git repository.

func (*RepoSource) LoadRepo added in v0.3.0

func (rs *RepoSource) LoadRepo(name string) error

LoadRepo loads a repository from disk.

func (*RepoSource) LoadRepos

func (rs *RepoSource) LoadRepos() error

LoadRepos opens Git repositories.

Jump to

Keyboard shortcuts

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