pub fn from_tree<Find, E1, E2>(
    tree: ObjectId,
    find: Find,
    pipeline: Pipeline,
    attributes: impl FnMut(&BStr, EntryMode, &mut Outcome) -> Result<(), E2> + Send + 'static
) -> Streamwhere
    Find: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<Data<'a>, E1> + Clone + Send + 'static,
    E1: Error + Send + Sync + 'static,
    E2: Error + Send + Sync + 'static,
Expand description

Use find 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 of git log.