Skip to main content

normalize_lexical

Function normalize_lexical 

Source
pub fn normalize_lexical(path: &Path) -> PathBuf
Expand description

Lexically normalize a path (collapse ./.., no filesystem access).

SAFEST documented semantics, chosen deliberately over the drifting copies this replaces: leading .. components are retained rather than silently dropped (a/../../b normalizes to ../b, never b), so an input that escapes its base stays visibly escapable instead of being quietly rewritten into a different path. Mirrors the component cleanup git’s strbuf_realpath_forgiving performs on the parts of a path that do not exist on disk.