pub fn from_tree<Find, E>(
tree: ObjectId,
objects: Find,
pipeline: Pipeline,
attributes: impl FnMut(&BStr, EntryMode, &mut Outcome) -> Result<(), E> + Send + 'static,
) -> Stream
Expand description
Use objects
to traverse tree
and fetch the contained blobs to return as Stream
, which makes them queryable
on demand with support for streaming each entry.
pipeline
is used to convert blobs to their worktree representation, and attributes
is used to read
the export-ignore
attribute. If set on a directory or blob, it won’t be added to the archive.
§Types of entries in stream
We only return blobs (with or without executable), which may be symlinks in which case their content will be target of the symlink. Directories are never returned, but maybe added by the caller via Stream::add_entry().
§Progress and interruptions
For per-file progress, integrate progress handling into the calls of Stream::next_entry()
as that
correlates blobs.
Additional interrupt handling can be wrapped around the Read
implementation of each Entry
.
For progress on bytes-written, integrate progress reporting when consuming the stream.
Further it’s possible to drop the returned Stream
to halt all operation.
§Threaded Operation
This function spawns a thread that will access the tree data in the background, synchronized through
Stream
so that it will not be faster than the consumer, with at most one file in flight at any time.
§Limitations
export-subst
is not support, as it requires the entire formatting engine ofgit log
.