Skip to main content

tree_hash

Function tree_hash 

Source
pub fn tree_hash(root: &Path) -> Result<String, ChestError>
Expand description

The content hash of the package tree at root, as sha256-<hex>.

It covers every regular file below root, leaving out every entry named .git at any depth, a folder or the file a worktree or submodule has, in the byte order of their /-separated relative paths. Each file adds its path, a NUL, x when it is executable (any execute bit on Unix, never elsewhere) or -, then the SHA-256 of its contents. A file at root hashes as a tree of that one file with an empty path. Fails on any symbolic link, root included, and on a path that is not UTF-8.