MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / relative_to_worktree

Function relative_to_worktree

crates/opencode-session/src/snapshot.rs:266–276  ·  view source on GitHub ↗
(worktree: &Path, input: &Path)

Source from the content-addressed store, hash-verified

264}
265
266fn relative_to_worktree(worktree: &Path, input: &Path) -> String {
267 if input.is_absolute() {
268 input
269 .strip_prefix(worktree)
270 .ok()
271 .map(|p| p.to_string_lossy().to_string())
272 .unwrap_or_default()
273 } else {
274 input.to_string_lossy().to_string()
275 }
276}
277
278#[cfg(test)]
279mod tests {

Callers 1

revertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected