forge

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func MirrorLock(path string) *sync.Mutex

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.

func (Git) HeadSHA

func (Git) HeadSHA(ctx context.Context, remote, branch string) (string, error)

HeadSHA implements Forge; ls-remote only talks to the remote, so no local repository is needed.

func (Git) MergeIntoTarget

func (Git) MergeIntoTarget(ctx context.Context, op Merge) (Result, error)

MergeIntoTarget implements Forge.

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

type Result struct {
	Status Status
	SHA    string
	Detail string
}

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL