Documentation
¶
Index ¶
- Constants
- func Eject(ctx context.Context, d *db.DB, p *paths.Paths, workDir string) (*db.Repo, error)
- func Init(ctx context.Context, d *db.DB, p *paths.Paths, workDir string) (*db.Repo, bool, error)
- func InitWithFork(ctx context.Context, d *db.DB, p *paths.Paths, workDir, forkURL string) (*db.Repo, bool, error)
- func RefreshRepoURLs(ctx context.Context, database *db.DB, repo *db.Repo) (*db.Repo, bool, error)
- type RefreshFailureReason
Constants ¶
const ( RemoteName = "no-slop" LegacyRemoteName = "no-mistakes" )
RemoteName is the canonical Git remote that points to the local gate. LegacyRemoteName remains wired to the exact same bare repository.
Variables ¶
This section is empty.
Functions ¶
func Eject ¶
Eject removes the no-slop gate from the repo at workDir. It removes both working-tree remotes, deletes the bare repo and worktrees, and deletes the repo record from the database.
func Init ¶
Init sets up a no-slop gate for the git repo at workDir. It creates a bare repo, installs the post-receive hook, best-effort isolates the bare repo's hooks path from shared local config writes when Git supports config --worktree, adds the canonical no-slop remote and the no-mistakes compatibility remote, and records the repo in the database.
Init is idempotent: re-running it on an already-initialized repo repairs and refreshes the gate (for example installing a newer hook, picking up hook-path isolation, or restoring a missing remote) instead of failing. This includes a working directory that was renamed or moved since the gate was created: the gate identified by a leftover no-slop or no-mistakes remote is reattached at the new path, preserving its run history. The returned bool reports whether a new gate was created (true) or an existing one was refreshed (false).
func InitWithFork ¶
func InitWithFork(ctx context.Context, d *db.DB, p *paths.Paths, workDir, forkURL string) (*db.Repo, bool, error)
InitWithFork is Init plus an optional GitHub fork push URL. The origin remote remains the parent repository used for PRs. When forkURL is empty, an existing fork setting is preserved across idempotent refreshes.
func RefreshRepoURLs ¶
RefreshRepoURLs best-effort discovers the current registered targets from the working clone and atomically replaces both URL fields. Origin remains the authoritative upstream source. An existing fork is refreshed only when one unique clone remote still identifies that same fork repository.
It never mutates Git configuration. Every failure is deliberately URL-free so callers can safely log only ReasonForRefreshFailure and continue with the exact repo value they already hold.
Types ¶
type RefreshFailureReason ¶
type RefreshFailureReason string
RefreshFailureReason is a bounded, URL-free reason safe to emit in logs.
const ( RefreshRemoteUnreadable RefreshFailureReason = "remote_unreadable" RefreshAmbiguousRemote RefreshFailureReason = "ambiguous_remote" RefreshInvalidRemote RefreshFailureReason = "invalid_remote" RefreshDatabaseWrite RefreshFailureReason = "database_write" )
func ReasonForRefreshFailure ¶
func ReasonForRefreshFailure(err error) RefreshFailureReason
ReasonForRefreshFailure returns a bounded reason that contains no remote URL or wrapped dependency output.