Documentation
¶
Overview ¶
Package git shells out to the git CLI to read diff data for a repo.
Index ¶
- Variables
- func IsBinary(content []byte) bool
- type ChangedFile
- type Driver
- func (d *Driver) BaseRef(root string) (ref, describe string, err error)
- func (d *Driver) BranchBase(root, override string) (ref, describe string, err error)
- func (d *Driver) BranchRefs(root string) ([]string, error)
- func (d *Driver) ChangedFiles(root string, scope Scope, baseRef string) ([]ChangedFile, error)
- func (d *Driver) CountWorkingLines(root, path string) (LineCount, error)
- func (d *Driver) Fingerprint(root string, scope Scope, baseRef string) (uint64, error)
- func (d *Driver) IndexFile(root, path string) ([]byte, error)
- func (d *Driver) IsRepoRoot(dir string) bool
- func (d *Driver) LastCommitParent(root string) string
- func (d *Driver) NumStat(root string, scope Scope, baseRef string) (map[string]FileStat, error)
- func (d *Driver) OpenRepo(dir string) (Repo, error)
- func (d *Driver) ResolveRef(root, ref string) error
- func (d *Driver) ResolveRepos(cwd string) ([]string, error)
- func (d *Driver) ShowFile(root, ref, path string) ([]byte, error)
- func (d *Driver) WorkingFile(root, path string) ([]byte, error)
- func (d *Driver) Worktrees(root string) ([]Worktree, error)
- type FileStat
- type LineCount
- type Repo
- type Scope
- type Status
- type Worktree
Constants ¶
This section is empty.
Variables ¶
var ErrNotARepo = errors.New("not a git repository")
Functions ¶
Types ¶
type ChangedFile ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) BaseRef ¶
BaseRef finds the merge base against the repo's main branch for the branch scope, returning the resolved ref and a short description.
func (*Driver) BranchBase ¶ added in v0.6.0
BranchBase resolves the base ref the branch scope diffs against. A non-empty override is validated first and fails loudly when it no longer resolves, never falling back to auto-detection; empty override auto-detects.
func (*Driver) BranchRefs ¶ added in v0.6.0
BranchRefs lists local and remote branch short names, dropping origin/HEAD and the bare origin ref that name a remote's default rather than a branch.
func (*Driver) ChangedFiles ¶
func (*Driver) CountWorkingLines ¶ added in v0.6.0
CountWorkingLines streams a working-tree file, so files too big to diff still count.
func (*Driver) Fingerprint ¶
Fingerprint hashes the repo state visible to a scope so callers can cheaply detect when a reload is needed.
func (*Driver) IsRepoRoot ¶ added in v0.6.0
func (*Driver) LastCommitParent ¶ added in v0.9.1
LastCommitParent returns HEAD's parent ref, or git's empty-tree object when HEAD is a root commit.
func (*Driver) ResolveRef ¶ added in v0.6.0
ResolveRef reports whether ref names a commit reachable in root.
func (*Driver) ResolveRepos ¶ added in v0.5.0
ResolveRepos returns the git repo roots reachable from cwd, most-active first. When cwd is itself a repo, that repo plus its linked worktrees are the roots. When cwd is an umbrella folder holding several repos, each nested repo root is returned ranked with dirty working trees before clean ones, then by most recent commit, so review lands on the repo the agent is most likely editing.
type LineCount ¶ added in v0.6.0
LineCount reports a file's lines; Counted is false when it could not be scanned.