Documentation
¶
Overview ¶
Package local implements backend.Repo for a repository on disk by driving the git command line. Every call is one or two short-lived git child processes; git itself is safe for concurrent readers, so the type holds no locks beyond a small cache for recursive file listings.
Index ¶
- type Repo
- func (r *Repo) AheadBehind(ctx context.Context, rev, base string) (ahead, behind int, err error)
- func (r *Repo) Archive(ctx context.Context, rev, format, prefix string, w io.Writer) error
- func (r *Repo) Blame(ctx context.Context, rev, pth string) ([]backend.BlameHunk, error)
- func (r *Repo) Blob(ctx context.Context, rev, pth string) (backend.Blob, error)
- func (r *Repo) Commit(ctx context.Context, sha string) (backend.CommitDetail, error)
- func (r *Repo) CommitCount(ctx context.Context, rev string) (int, error)
- func (r *Repo) Commits(ctx context.Context, rev, pth string, n, skip int) ([]backend.Commit, bool, error)
- func (r *Repo) Files(ctx context.Context, rev string) ([]string, error)
- func (r *Repo) Info(ctx context.Context) (backend.Info, error)
- func (r *Repo) LastCommit(ctx context.Context, rev, pth string) (backend.Commit, error)
- func (r *Repo) Refs(ctx context.Context) (backend.Refs, error)
- func (r *Repo) Resolve(ctx context.Context, ref string) (string, error)
- func (r *Repo) Tree(ctx context.Context, rev, pth string) ([]backend.TreeEntry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo drives git for one repository.
func (*Repo) AheadBehind ¶
AheadBehind reports how many commits rev has that base lacks and the reverse. The server uses it on the branches page; it is not part of the backend contract.
func (*Repo) Blame ¶
Blame parses `git blame --porcelain`. The porcelain stream emits, per line, a "<sha> <orig> <final> [<n>]" header where <n> appears only on the first line of a hunk, followed by key-value commit fields the first time a commit is seen, then the content line prefixed with a tab.
func (*Repo) Commit ¶
Commit returns one commit with its diff against the first parent, or against the empty tree for a root commit, the way github.com renders commit pages.
func (*Repo) CommitCount ¶
CommitCount reports how many commits are reachable from rev. The server uses this for the "N commits" header link via an optional interface.