Documentation
¶
Overview ¶
Package git implements ports.ConfigRepo against the system git binary. Every operation is an exec with an argument vector (no shell), scoped to the repo directory with -C. The adapter never interprets file contents.
Index ¶
- func RemoteHead(ctx context.Context, remote string) (string, error)
- type Repo
- func (r *Repo) AddWorktree(ctx context.Context, dir, branch string) error
- func (r *Repo) BranchMerged(ctx context.Context, branch string) (bool, error)
- func (r *Repo) Commit(ctx context.Context, msg string, a ports.Author, files ...string) error
- func (r *Repo) CommitCount(ctx context.Context, rev string) (int, error)
- func (r *Repo) CreateBranch(ctx context.Context, name string) error
- func (r *Repo) DeleteBranch(ctx context.Context, name string) error
- func (r *Repo) DeleteRemoteRef(ctx context.Context, name string) error
- func (r *Repo) Diff(ctx context.Context, branch string) (string, error)
- func (r *Repo) Dir() string
- func (r *Repo) FileAt(ctx context.Context, rev, path string) ([]byte, error)
- func (r *Repo) HasRemote() bool
- func (r *Repo) Head(ctx context.Context) (string, error)
- func (r *Repo) ListFiles(dir string) ([]string, error)
- func (r *Repo) Log(ctx context.Context, limit int) ([]ports.AuditEntry, error)
- func (r *Repo) MergeNoFF(ctx context.Context, branch, msg string, a ports.Author) error
- func (r *Repo) Push(ctx context.Context) error
- func (r *Repo) PushRef(ctx context.Context, name string) error
- func (r *Repo) ReadFile(name string) ([]byte, error)
- func (r *Repo) RemoveFile(name string) error
- func (r *Repo) RemoveWorktree(ctx context.Context, dir string) error
- func (r *Repo) ResetHard(ctx context.Context, rev string) error
- func (r *Repo) SetRef(ctx context.Context, name, rev string) (bool, error)
- func (r *Repo) SourceKey(ctx context.Context, exclude string) (string, error)
- func (r *Repo) Sync(ctx context.Context) error
- func (r *Repo) WriteFile(name string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is one git working tree acting as a config repo.
func Open ¶
Open returns a Repo for an existing working tree. The directory must contain a git repository (a .git directory, or a .git file for a linked worktree); callers provision repos out of band.
func (*Repo) AddWorktree ¶
AddWorktree implements ports.BranchRepo. Same "--" guard as CreateBranch: it stops a dir/branch starting with "-" from being misread as a flag.
func (*Repo) BranchMerged ¶ added in v0.79.0
BranchMerged implements ports.BranchRepo. Answers from git, which is the authority on whether a merge happened.
Deliberately two calls rather than "merge-base --is-ancestor": that reports its answer through the EXIT CODE, and this package's git helper turns any non-zero exit into a message, so "not an ancestor" and "no such branch" would arrive indistinguishable. They are different answers, and conflating them would let a deleted branch read as "not merged" - leaving a change in Ready forever, the opposite of the reconciliation this serves.
func (*Repo) Commit ¶
Commit implements ports.ConfigRepo. The author comes from the session so the audit trail names a person, with a service fallback.
func (*Repo) CommitCount ¶ added in v0.65.3
CommitCount returns the number of commits reachable from rev - a monotonic "release number" for lineage-ordered revisions on one branch. Humans compare 142 vs 145 at a glance where two sha prefixes say nothing.
func (*Repo) CreateBranch ¶
CreateBranch implements ports.BranchRepo. The "--" stops a name starting with "-" from being misread as a flag (mirrors Commit's "git add --").