Skip to main content

working_tree_path

Function working_tree_path 

Source
pub fn working_tree_path(name: &[u8]) -> PathBuf
Expand description

The working-tree path an index entry names, without decoding it.

The index spells paths as raw bytes with forward slashes, and on Unix that is what a filename is — going through a lossy String would turn any byte that is not UTF-8 into U+FFFD and open a file that does not exist, or worse, a different one. The same mistake was found and fixed on the filter path in the S-01 review.

Shared rather than spelled once per caller: status reads working-tree files by index name and lock proves them closed by index name, and two answers to “which file does this entry mean” is one answer too many. Messages take a different route — they may be lossy, and they say so.