A snapshot of every file in the repository at one point in history.
Trees are backed either by a git tree object or by an in-memory map of
paths to contents. The rest of the library only ever calls paths/1,
exists?/2, and read/2, so both backends behave identically.
Summary
Functions
The blob object id of path, or nil for in-memory trees and missing paths.
Builds a tree from a git tree object.
Builds an in-memory tree from a map of paths to file contents.
Every path in the tree, sorted.
Returns a tree whose reads of paths are served from memory, fetched in
one git archive call. Other paths still go through git. In-memory trees
are returned unchanged.
Reads the file at path, or :error if it does not exist in this tree.
Reads the file at path, raising if it does not exist.
Types
Functions
The blob object id of path, or nil for in-memory trees and missing paths.
@spec from_git(Path.t(), Presubmit.Git.oid()) :: t()
Builds a tree from a git tree object.
Builds an in-memory tree from a map of paths to file contents.
Every path in the tree, sorted.
Returns a tree whose reads of paths are served from memory, fetched in
one git archive call. Other paths still go through git. In-memory trees
are returned unchanged.
Reading many files one cat-file at a time is what dominates the cost of
tree-wide discovery, so anything about to read a batch should prefetch it.
Reads the file at path, or :error if it does not exist in this tree.
Reads the file at path, raising if it does not exist.