gix_path

Function relativize_with_prefix

source
pub fn relativize_with_prefix<'a>(
    relative_path: &'a Path,
    prefix: &Path,
) -> Cow<'a, Path>
Expand description

Rebuild the worktree-relative relative_path to be relative to prefix, which is the worktree-relative path equivalent to the position of the user, or current working directory. This is a no-op if prefix is empty.

Note that both relative_path and prefix are assumed to be normalized, and failure to do so will lead to incorrect results.

Note that both input paths are expected to be equal in terms of case too, as comparisons will be case-sensitive.