Skip to main content

hash_file

Function hash_file 

Source
pub fn hash_file(store: &ObjectStore, path: &Path) -> WorktreeResult<Hash>
Expand description

Read a file from disk, hash it, store it, and return the content-address of the resulting object.

Files at or below CHUNK_THRESHOLD become a single Blob. Files above the threshold are split with FastCdc::v1; each chunk is stored as a Blob, and the file is represented by a ChunkedBlob manifest whose hash is returned and lands in the parent tree. See SPEC-FASTCDC.md and SPEC-OBJECTS.md §7.

§Errors

See WorktreeError.