Documentation
¶
Overview ¶
Package forge merges a finished branch into a target ref on any git remote. It is the shem-side half of epic integration: plain git commands in a Golem-owned mirror, no forge vendor involved.
Forge is an interface so the worker depends on the operation, not on the git CLI; Git is the only implementation today, by design — plain git speaks to every remote already.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MirrorLock ¶
MirrorLock shares the merge lane's mutex with worker mirror initialization and base-ref creation, which use the same bare repository.
Types ¶
type Forge ¶
type Forge interface {
// HeadSHA returns the remote's current head for branch, or "" when
// the branch does not exist there.
HeadSHA(ctx context.Context, remote, branch string) (string, error)
// MergeIntoTarget integrates one branch into one target ref.
MergeIntoTarget(ctx context.Context, op Merge) (Result, error)
}
Forge is the integration surface the shem worker depends on.
type Git ¶
type Git struct{}
Git is the plain-git Forge. The zero value is ready to use.
type Merge ¶
type Merge struct {
Mirror string
Remote string
Branch string
HeadSHA string
TargetRef string
Message string
MaxAttempts int
}
Merge pins one integration: Branch at HeadSHA into TargetRef on Remote, executed inside Mirror (a bare, Golem-owned repository, created if missing). MaxAttempts bounds compare-and-swap retries when the target moves under the push; zero means the default.
type Result ¶
Result reports what MergeIntoTarget did. SHA is the resulting target head for Merged and the existing target head for Contained.
type Status ¶
type Status string
Status is the outcome of one MergeIntoTarget call. Operational failures (the git binary, the network, a missing mirror) come back as errors instead: they are retried later, never reported as verdicts.
const ( // Merged: a merge commit was created and pushed to the target ref. Merged Status = "merged" // Contained: the head was already reachable from the target — a merge // that already happened (a retry after a crash), so only the receipt // is owed. Contained Status = "contained" // Conflict: the branch does not merge cleanly; Detail names the // conflicted files. Conflict Status = "conflict" // Moved: the remote branch head no longer equals Merge.HeadSHA — the // pin this merge was gated on is stale. Moved Status = "moved" // Rejected: the remote refused the push (permissions, protected // branch, a hook). Detail carries the remote's own words. Rejected Status = "rejected" )