gitremote

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 1 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 gitremote is the seam between the mirror and the git remotes that it talks to: listing the refs of a remote and pushing refs to it. The mirror owns the interface. gitbin runs the git binary, and fakeremote keeps the refs in memory.

Index

Constants

View Source
const (
	AskpassFileEnv = "WARD_ASKPASS_FILE"
	AskpassUserEnv = "WARD_ASKPASS_USER"
)

Names of the environment variables that tell the askpass helper which file and user to answer with.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cred

type Cred struct {
	Header  string
	AskUser string
	AskFile string
	// KeepGC leaves gc.auto at its default, for the explicit maintenance command of a git run.
	KeepGC bool
}

Cred is the credential of one run. Header is a complete HTTP header line. AskFile and AskUser feed the askpass helper.

type Error

type Error struct {
	Stderr   string
	Err      error
	TimedOut bool
}

Error is a failure of a git run. Stderr is its error output, and TimedOut is true when the time limit ended it.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Outcome

type Outcome int

Outcome is the result of one ref of a push.

const (
	// OK means that the remote holds the pushed value, or lacks a ref that the push deleted.
	OK Outcome = iota
	// Stale means that the lease refused the ref: the remote moved outside the caller.
	Stale
	// Rejected means that the remote refused the ref for another reason.
	Rejected
)

type PushSpec

type PushSpec struct {
	Ref      string
	Commit   string
	Lease    string
	LeaseSet bool
}

PushSpec is one ref of a push. An empty Commit deletes the ref. With LeaseSet, the push moves the ref only when the remote holds Lease, and an empty Lease means that the ref must be absent.

type Remote

type Remote interface {
	// List returns the refs of the remote under refs/ that name a commit, as git name to commit. It skips HEAD and peeled tags.
	List(ctx context.Context, url string, c Cred) (map[string]string, error)
	// Push sends the specs in one push from the repository at clone, and reports the outcome of each ref. A delete of a ref that
	// the remote lacks is OK. An error means that the push as a whole failed.
	Push(ctx context.Context, clone, url string, c Cred, specs []PushSpec) (map[string]Outcome, error)
}

Remote is a git remote.

Directories

Path Synopsis
Package fakeremote is a gitremote.Remote that keeps the refs of each URL in memory.
Package fakeremote is a gitremote.Remote that keeps the refs of each URL in memory.
Package gitbin is the gitremote.Remote that runs the git binary with a clean environment.
Package gitbin is the gitremote.Remote that runs the git binary with a clean environment.
Package remotetest is the conformance suite of gitremote.Remote.
Package remotetest is the conformance suite of gitremote.Remote.

Jump to

Keyboard shortcuts

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