Skip to content

Commit 2ca4cec

Browse files
committed
test(oxide): document lexical path normalization
1 parent e344530 commit 2ca4cec

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

crates/oxide/src/scanner/sources.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ fn resolve_path(path: &Path, preserve_symlinks: bool) -> std::io::Result<PathBuf
180180
dunce::canonicalize(path)
181181
}
182182

183+
/// Lexically normalize an absolute path without resolving it through the
184+
/// filesystem.
185+
///
186+
/// This intentionally preserves symlink path shapes, so `..` segments after a
187+
/// symlinked component are collapsed without resolving to the symlink target.
188+
/// Current callers pass absolute paths; relative paths with leading `..`
189+
/// segments would lose those leading components because `PathBuf::pop` on an
190+
/// empty buffer is a no-op.
183191
fn normalize_path_lexically(path: &Path) -> PathBuf {
184192
let mut normalized = PathBuf::new();
185193

0 commit comments

Comments
 (0)