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
- func Carried(repoRoot string) ([]string, error)
- func LstatInRoot(root *os.Root, rel string) (fs.FileInfo, error)
- func ReadInRoot(root *os.Root, rel string, limit int64) ([]byte, error)
- func ReadInRootContext(ctx context.Context, root *os.Root, rel string, limit int64) ([]byte, error)
- func Untracked(repoRoot, rel string) error
- func UntrackedContext(ctx context.Context, repoRoot, rel string) error
- func UntrackedEach(ctx context.Context, repoRoot string, rels ...string) error
- type Refused
Constants ¶
const ( GeneratedSetRel = RelDir + "/reservation/generated" GeneratedSetMagic = "abcd generated set" )
The generated-set cache the reservation views keep (internal/core/claim): GeneratedSetRel is its path, relative to a checkout's root, and GeneratedSetMagic is its first field, ended by a NUL as every field in it is. The cache is abcd's own, re-derived by the next read, so the worktree store's notes archive leaves out a file at that path that opens with them.
const RelDir = ".abcd/.work.local"
RelDir is the local tier, relative to a checkout's root.
Variables ¶
This section is empty.
Functions ¶
func Carried ¶
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 ¶
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 ¶
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 ReadInRootContext ¶ added in v0.17.0
ReadInRootContext is ReadInRoot with its tracked check bound to ctx (UntrackedContext), for a reader that holds a budget: a ctx already ended starts no git and refuses, as git not answering does.
func Untracked ¶
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 ¶
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 ¶
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 ¶
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".