Help us shape the future of Go! Take the 2026 Go Developer Survey

repolayout

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package repolayout records the on-disk contract for Git repository data. Upgrades may add files under the extensions directory. They must not move or rewrite bare repositories, Git objects, refs, or LFS object bytes.

Index

Constants

View Source
const (
	// Version is the layout contract implemented by this binary.
	Version = 1
	// ContractGitObjectsImmutable is the only accepted contract name.
	ContractGitObjectsImmutable = "git-objects-immutable"

	// RoleRepositories is the frozen bare-repository tree.
	RoleRepositories = "git-repositories"
	// RoleLFS is the frozen Git LFS object store.
	RoleLFS = "git-lfs"
	// RoleDatabase is the frozen application database location.
	RoleDatabase = "database"
)

Variables

View Source
var ErrFutureLayout = errors.New("git layout is newer than this gitsss version")

ErrFutureLayout means a newer gitsss already recorded a layout this binary does not understand. Callers must stop without changing Git or LFS data.

Functions

func ExtensionsPath

func ExtensionsPath(dataRoot string) string

ExtensionsPath returns the directory future upgrades may populate.

func ManifestPath

func ManifestPath(dataRoot string) string

ManifestPath returns the sidecar path under the application data root.

func RequiredFrozen

func RequiredFrozen() []string

RequiredFrozen returns the role names every layout v1 file must contain.

func ReserveExtension

func ReserveExtension(dataRoot, repoRoot, lfsRoot, id string) (string, error)

ReserveExtension records an additive feature directory. The id is a single path segment. The returned directory is always inside the extensions tree.

Types

type Manifest

type Manifest struct {
	LayoutVersion int               `json:"layout_version"`
	Contract      string            `json:"contract"`
	Frozen        []string          `json:"frozen"`
	ExtensionsDir string            `json:"extensions_dir"`
	Reserved      map[string]string `json:"reserved,omitempty"`
}

Manifest is the sidecar stored beside repository data.

func Ensure

func Ensure(dataRoot, repoRoot, lfsRoot string) (Manifest, error)

Ensure creates or updates the sidecar. It refuses a newer layout and does not create, move, or open repository or LFS trees.

func Read

func Read(dataRoot string) (Manifest, error)

Read loads the sidecar without creating or changing it. A missing frozen role or a newer layout version is an error.

Jump to

Keyboard shortcuts

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