localtier

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 11 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 localtier guards reads of a checkout's local tier, .abcd/.work.local/: the run, drain and build states, receipts, holds and keys abcd keeps for one checkout alone. The tier is ignored by design and never committed, so a file in it that git tracks came with a commit, not from this checkout, and is not this checkout's state. Every reader of such state asks Untracked first.

Index

Constants

View Source
const RelDir = ".abcd/.work.local"

RelDir is the local tier, relative to a checkout's root.

Variables

This section is empty.

Functions

func Carried

func Carried(repoRoot string) ([]string, error)

Carried lists what git tracks in the working tree at repoRoot that reaches its local tier: an entry inside the directory the tier's name opens, by whatever spelling git holds it (a case or Unicode variant the filesystem folds onto it), the tier itself as an entry (a link, a submodule or a file standing in for it), or .abcd itself as one. Outside anything repository-shaped it lists nothing; a tree git cannot answer for is an error.

func LstatInRoot

func LstatInRoot(root *os.Root, rel string) (fs.FileInfo, error)

LstatInRoot is root.Lstat for local-tier state a reader judges by its presence alone (a receipt that lets a step pass), refused as ReadInRoot refuses once there is something to refuse.

func ReadInRoot

func ReadInRoot(root *os.Root, rel string, limit int64) ([]byte, error)

ReadInRoot is fsutil.ReadGuardedInRoot for local-tier state: rel, relative to root, is refused as Untracked refuses it, and its bytes are never handed back when it is. Git is asked only once there is a file to refuse, so an absent one costs no question. The refusal is never an fs.ErrNotExist, so a reader that takes an absent file as "no state" still refuses one a commit carries.

func Untracked

func Untracked(repoRoot, rel string) error

Untracked returns nil when nothing git tracks supplies the file or directory at rel, a slash-separated path relative to repoRoot (a file a reader opens, or a directory it lists), and otherwise a *Refused: naming what git tracks, or, when git cannot answer for a repository-shaped tree, saying so. Outside anything repository-shaped no commit can carry the file, and it returns nil.

What git tracks is judged by the files it names, not by their spelling: an entry is refused when it is rel or lies beneath it, and also when it reaches the tier (Carried) and opens rel or a directory above or below it, so a spelling the filesystem folds onto the path, a link or a submodule standing in for the tier, or one standing in for .abcd, is refused as surely as the path's own name. An entry elsewhere in the tier supplies nothing to rel and leaves its read alone; record-lint reports it at the change that tracks it. repoRoot may be any directory inside the checkout, rel then relative to it, as a reader holding an os.Root opened on a run or lane directory has them; the refusal names paths from the working tree's top, where its remedy runs.

func UntrackedContext

func UntrackedContext(ctx context.Context, repoRoot, rel string) error

UntrackedContext is Untracked with its git calls bound to ctx, for a reader that holds a budget; a context that ends first refuses, as git not answering does.

func UntrackedEach

func UntrackedEach(ctx context.Context, repoRoot string, rels ...string) error

UntrackedEach is UntrackedContext for every one of rels, asking git once: for a reader that lists a directory and reads what it finds there, so a file git tracks beside the ones it reads refuses none of them. The refusal is the first rel refused.

Types

type Refused

type Refused struct {
	Rel   string
	Paths []string
	Cause error
}

Refused is Untracked's refusal: git tracks something at or beneath Rel, or something that reaches the tier (Paths, the first few of them), or git could not say whether it does (Cause), which is never read as "nothing tracked".

func (*Refused) Error

func (e *Refused) Error() string

func (*Refused) Reason

func (e *Refused) Reason() string

Reason says why the read is refused, naming the path.

func (*Refused) Remedy

func (e *Refused) Remedy() string

Remedy says what makes the read possible again.

Jump to

Keyboard shortcuts

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