Skip to content

Relative paths with . are not handled correctly #9

@jornbh

Description

@jornbh

Depending on if a relative path starts with a "." or not, the same diff will give different results.

        let path_a = PathBuf::new(r"a\b\c");
        let path_a_with_dot = PathBuf::new(r".\a\b\c");
        let path_b = PathBuf::new(r"a\e\g");
        let expected_diff_a_to_b = PathBuf::new(r"..\..\..\e\g");

       assert_eq!( pathdiff::diff_paths(&path_b, &path_a).unwrap(), expected_diff_a_to_b ); // Will work fine
       assert_eq!( pathdiff::diff_paths(&path_b, &path_a_with_dot).unwrap(), expected_diff_a_to_b ); // Will panic

The second assert will fail with the left hand side being r"a/../../../../e/g/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions