pub fn capture(snapshot: &Snapshot, store: &Path) -> Result<Captured, ScanError>Expand description
Copies a snapshot’s files into store and hashes the bytes copied (decision 102): parse
jobs and tasks import from the copy, so the code that runs is the code hashed, whatever
happens to the root afterwards (git-sync deleting a checkout, an edit in place). A
followed link is copied as its target’s contents; the copy is read-only (executable bits
kept), so no task changes another’s code by accident. The hash is the same as
content_hash’s.
The root is hashed first: a copy already in store for that hash is used as it is, and
nothing is written. A copy is complete whenever it has its hash’s name: it is written
under a temporary name and renamed into place, and remove_capture renames it away
before deleting it.
§Errors
ScanError::Read if a file can’t be read, ScanError::Copy if the copy can’t be
written.