Skip to main content

hash_file_object

Function hash_file_object 

Source
pub fn hash_file_object(data: &[u8]) -> WorktreeResult<Hash>
Expand description

Content-address data exactly as store_file_object would, without storing anything. Computes per-chunk blob hashes via the streaming hasher and assembles the ChunkedBlob manifest in memory. Backs change detection (status, rm, restore safety checks) where only the answer “would this file hash to X?” is needed — writing objects there would turn a read-only query into store mutation. Equivalence with store_file_object is pinned by test.

§Errors

WorktreeError::Object if a length exceeds the wire-format cap.