path: root/t/
diff options
authorJiang Xin <>2013-10-14 02:29:39 (GMT)
committerJonathan Nieder <>2013-10-14 14:00:26 (GMT)
commit7fbd422162f2b49bc06a29a063f519450165dc86 (patch)
tree206305e4a38d3e6858d89f7d11dfb48fb0b082c0 /t/
parentdaf19a80fa6b7402f8a2efa8f8255b4b5d6b48a9 (diff)
relative_path should honor dos-drive-prefix
Tvangeste found that the "relative_path" function could not work properly on Windows if "in" and "prefix" have DOS drive prefix (such as "C:/windows"). ($gmane/234434) E.g., When execute: test-path-utils relative_path "C:/a/b" "D:/x/y", should return "C:/a/b", but returns "../../C:/a/b", which is wrong. So make relative_path honor DOS drive prefix, and add test cases for it in t0060. Reported-by: Tvangeste <> Helped-by: Johannes Sixt <> Signed-off-by: Jiang Xin <> Signed-off-by: Jonathan Nieder <>
Diffstat (limited to 't/')
1 files changed, 4 insertions, 0 deletions
diff --git a/t/ b/t/
index 92976e0..40dfa2d 100755
--- a/t/
+++ b/t/
@@ -210,6 +210,10 @@ relative_path foo/a/b/ foo/a/b ./
relative_path foo/a foo/a/b ../
relative_path foo/x/y foo/a/b ../../x/y
relative_path foo/a/c foo/a/b ../c
+relative_path foo/a/b /foo/x/y foo/a/b
+relative_path /foo/a/b foo/x/y /foo/a/b
+relative_path d:/a/b D:/a/c ../b MINGW
+relative_path C:/a/b D:/a/c C:/a/b MINGW
relative_path foo/a/b "<empty>" foo/a/b
relative_path foo/a/b "<null>" foo/a/b
relative_path "<empty>" /foo/a/b ./