Skip to content

Commit 01fda37

Browse files
committed
Clarify that normalise does not remove '..'
Fixes #86
1 parent b446540 commit 01fda37

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

System/FilePath/Internal.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,13 @@ makeRelative root path
835835
--
836836
-- * .\/ -> \"\"
837837
--
838+
-- Does not remove @".."@, because of symlinks.
839+
--
838840
-- > Posix: normalise "/file/\\test////" == "/file/\\test/"
839841
-- > Posix: normalise "/file/./test" == "/file/test"
840842
-- > Posix: normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/"
841843
-- > Posix: normalise "../bob/fred/" == "../bob/fred/"
844+
-- > Posix: normalise "/a/../c" == "/a/../c"
842845
-- > Posix: normalise "./bob/fred/" == "bob/fred/"
843846
-- > Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\"
844847
-- > Windows: normalise "c:\\" == "C:\\"

System/FilePath/Posix.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,13 @@ makeRelative root path
835835
--
836836
-- * .\/ -> \"\"
837837
--
838+
-- Does not remove @".."@, because of symlinks.
839+
--
838840
-- > Posix: normalise "/file/\\test////" == "/file/\\test/"
839841
-- > Posix: normalise "/file/./test" == "/file/test"
840842
-- > Posix: normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/"
841843
-- > Posix: normalise "../bob/fred/" == "../bob/fred/"
844+
-- > Posix: normalise "/a/../c" == "/a/../c"
842845
-- > Posix: normalise "./bob/fred/" == "bob/fred/"
843846
-- > Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\"
844847
-- > Windows: normalise "c:\\" == "C:\\"

System/FilePath/Windows.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,13 @@ makeRelative root path
835835
--
836836
-- * .\/ -> \"\"
837837
--
838+
-- Does not remove @".."@, because of symlinks.
839+
--
838840
-- > Posix: normalise "/file/\\test////" == "/file/\\test/"
839841
-- > Posix: normalise "/file/./test" == "/file/test"
840842
-- > Posix: normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/"
841843
-- > Posix: normalise "../bob/fred/" == "../bob/fred/"
844+
-- > Posix: normalise "/a/../c" == "/a/../c"
842845
-- > Posix: normalise "./bob/fred/" == "bob/fred/"
843846
-- > Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\"
844847
-- > Windows: normalise "c:\\" == "C:\\"

tests/TestGen.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ tests =
388388
,("P.normalise \"/file/./test\" == \"/file/test\"", property $ P.normalise "/file/./test" == "/file/test")
389389
,("P.normalise \"/test/file/../bob/fred/\" == \"/test/file/../bob/fred/\"", property $ P.normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/")
390390
,("P.normalise \"../bob/fred/\" == \"../bob/fred/\"", property $ P.normalise "../bob/fred/" == "../bob/fred/")
391+
,("P.normalise \"/a/../c\" == \"/a/../c\"", property $ P.normalise "/a/../c" == "/a/../c")
391392
,("P.normalise \"./bob/fred/\" == \"bob/fred/\"", property $ P.normalise "./bob/fred/" == "bob/fred/")
392393
,("W.normalise \"c:\\\\file/bob\\\\\" == \"C:\\\\file\\\\bob\\\\\"", property $ W.normalise "c:\\file/bob\\" == "C:\\file\\bob\\")
393394
,("W.normalise \"c:\\\\\" == \"C:\\\\\"", property $ W.normalise "c:\\" == "C:\\")

0 commit comments

Comments
 (0)