gitrepo

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package gitrepo builds the Git repository the acceptance phase reads schemas and migrations from: a linear history described by a Spec, written into an in-memory object store with fixed authors and times, so the same Spec always gives the same commit ids. The fixture server serves it, and the phase computes the ids it expects from the same Spec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitSpec

type CommitSpec struct {
	Message    string            `json:"message"`
	Files      map[string]string `json:"files"`
	Submodules map[string]string `json:"submodules,omitempty"`
}

CommitSpec is one commit: its message, every file of its tree, and the submodules in it, each a path and the commit id it links to. A submodule's commit is not in this repository, as it would not be in a real one.

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository is a built Spec.

func Build

func Build(spec Spec) (*Repository, error)

Build writes every commit of a Spec into a fresh object store.

func (*Repository) Commit

func (r *Repository) Commit(index int) plumbing.Hash

Commit returns the id of the commit at index.

func (*Repository) Refs

Refs is every branch and tag, by its full name. The caller may change the map it gets: it is a copy.

func (*Repository) Storage

func (r *Repository) Storage() *memory.Storage

Storage is the repository's object store.

type Spec

type Spec struct {
	Commits  []CommitSpec   `json:"commits"`
	Branches map[string]int `json:"branches"`
	Tags     map[string]int `json:"tags"`
}

Spec is the repository the server serves: a linear history, each commit a whole tree of files, and the refs that name commits by their index. Commits are written with a fixed author and a clock that starts at a fixed instant, so the same Spec always gives the same commit ids.

func ParseSpec

func ParseSpec(data []byte) (Spec, error)

ParseSpec reads a Spec and refuses one whose refs name no commit.

Jump to

Keyboard shortcuts

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