Documentation
¶
Index ¶
- func ParseGitStatus(output string) []model.DirtyFile
- type Decision
- type Engine
- type ExecGitRunner
- func (g *ExecGitRunner) Checkout(repoDir, branch string) error
- func (g *ExecGitRunner) Clone(url, dest string) error
- func (g *ExecGitRunner) CurrentBranch(repoDir string) (string, error)
- func (g *ExecGitRunner) DiffStats(repoDir string) (int, int, error)
- func (g *ExecGitRunner) Fetch(repoDir string) error
- func (g *ExecGitRunner) IsDirty(repoDir string) (bool, []model.DirtyFile, error)
- func (g *ExecGitRunner) PullFF(repoDir string) (bool, error)
- func (g *ExecGitRunner) RemoteURL(repoDir string) (string, error)
- func (g *ExecGitRunner) StatusShort(repoDir string) (string, error)
- func (g *ExecGitRunner) SubmoduleUpdate(repoDir string) error
- type GitRunner
- type LoggingGitRunner
- func (g *LoggingGitRunner) Checkout(repoDir, branch string) error
- func (g *LoggingGitRunner) Clone(url, dest string) error
- func (g *LoggingGitRunner) CurrentBranch(repoDir string) (string, error)
- func (g *LoggingGitRunner) DiffStats(repoDir string) (int, int, error)
- func (g *LoggingGitRunner) Fetch(repoDir string) error
- func (g *LoggingGitRunner) IsDirty(repoDir string) (bool, []model.DirtyFile, error)
- func (g *LoggingGitRunner) PullFF(repoDir string) (bool, error)
- func (g *LoggingGitRunner) RemoteURL(repoDir string) (string, error)
- func (g *LoggingGitRunner) StatusShort(repoDir string) (string, error)
- func (g *LoggingGitRunner) SubmoduleUpdate(repoDir string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseGitStatus ¶
ParseGitStatus parses git status --porcelain output into DirtyFile entries. This is a pure function for testability.
Types ¶
type Engine ¶
Engine orchestrates per-repo sync operations.
func NewEngine ¶
func NewEngine(baseDir string, verbosity int, logf func(string, ...any), tracef func(string, ...any)) *Engine
NewEngine creates a new sync engine. verbosity controls logging: 0=quiet, 1=verbose (cmd/exit), 2=trace (also raw output).
func (*Engine) CloneRepo ¶
func (e *Engine) CloneRepo(repo model.RepoInfo) model.RepoResult
CloneRepo clones a missing repository.
func (*Engine) ProcessRepo ¶
func (e *Engine) ProcessRepo(repo model.RepoInfo) model.RepoResult
ProcessRepo audits and syncs an existing local repository.
func (*Engine) StatusRepo ¶ added in v0.2.0
func (e *Engine) StatusRepo(repo model.RepoInfo) model.RepoResult
StatusRepo reads the current state of a repository without modifying it. It returns ActionDirty if the working tree is dirty, ActionBranchDrift if the repo is on a non-default branch (and clean), or ActionAlreadyCurrent if the repo is clean and on the default branch.
type ExecGitRunner ¶
type ExecGitRunner struct {
// contains filtered or unexported fields
}
ExecGitRunner runs real git commands. When tracef is set, the raw output of each command is forwarded to it.
func (*ExecGitRunner) Checkout ¶
func (g *ExecGitRunner) Checkout(repoDir, branch string) error
func (*ExecGitRunner) Clone ¶
func (g *ExecGitRunner) Clone(url, dest string) error
func (*ExecGitRunner) CurrentBranch ¶
func (g *ExecGitRunner) CurrentBranch(repoDir string) (string, error)
func (*ExecGitRunner) DiffStats ¶
func (g *ExecGitRunner) DiffStats(repoDir string) (int, int, error)
func (*ExecGitRunner) Fetch ¶
func (g *ExecGitRunner) Fetch(repoDir string) error
func (*ExecGitRunner) StatusShort ¶ added in v0.2.0
func (g *ExecGitRunner) StatusShort(repoDir string) (string, error)
func (*ExecGitRunner) SubmoduleUpdate ¶
func (g *ExecGitRunner) SubmoduleUpdate(repoDir string) error
type GitRunner ¶
type GitRunner interface {
Clone(url, dest string) error
Fetch(repoDir string) error
SubmoduleUpdate(repoDir string) error
CurrentBranch(repoDir string) (string, error)
IsDirty(repoDir string) (bool, []model.DirtyFile, error)
DiffStats(repoDir string) (int, int, error) // additions, deletions
Checkout(repoDir, branch string) error
PullFF(repoDir string) (bool, error) // returns true if changes were pulled
RemoteURL(repoDir string) (string, error)
StatusShort(repoDir string) (string, error) // returns colorized short status output
}
GitRunner executes git commands. Abstracted for testability.
type LoggingGitRunner ¶ added in v0.3.3
type LoggingGitRunner struct {
// contains filtered or unexported fields
}
LoggingGitRunner decorates a GitRunner with verbose command diagnostics. Before each operation it emits "git cmd: <command>" and afterward "git exit: 0" on success or "git exit: 1 error=<message>" on failure, along with any structured result values.
func (*LoggingGitRunner) Checkout ¶ added in v0.3.3
func (g *LoggingGitRunner) Checkout(repoDir, branch string) error
func (*LoggingGitRunner) Clone ¶ added in v0.3.3
func (g *LoggingGitRunner) Clone(url, dest string) error
func (*LoggingGitRunner) CurrentBranch ¶ added in v0.3.3
func (g *LoggingGitRunner) CurrentBranch(repoDir string) (string, error)
func (*LoggingGitRunner) DiffStats ¶ added in v0.3.3
func (g *LoggingGitRunner) DiffStats(repoDir string) (int, int, error)
func (*LoggingGitRunner) Fetch ¶ added in v0.3.3
func (g *LoggingGitRunner) Fetch(repoDir string) error
func (*LoggingGitRunner) PullFF ¶ added in v0.3.3
func (g *LoggingGitRunner) PullFF(repoDir string) (bool, error)
func (*LoggingGitRunner) RemoteURL ¶ added in v0.3.3
func (g *LoggingGitRunner) RemoteURL(repoDir string) (string, error)
func (*LoggingGitRunner) StatusShort ¶ added in v0.3.3
func (g *LoggingGitRunner) StatusShort(repoDir string) (string, error)
func (*LoggingGitRunner) SubmoduleUpdate ¶ added in v0.3.3
func (g *LoggingGitRunner) SubmoduleUpdate(repoDir string) error