I don't know how to safely test it via a shell script in tests/, so if
versed in Haskell unit testing could add a test checking something like
makeSubPathOf (AbsolutePath "/") (AbsolutePath "/dir") = Just (SubPath
It occurred to me that this patch possibly doesn't work or could even do
harmful things in Windows, depending on how file paths are represented.
1. if absolute paths are in the form '/<volume>/<path>' (unlikely, I
think), this patch does evil things(tm), like considering '/D/file' to
be part of '/C/' repo.
2. if absolute paths are in the form '<volume>:\<path>' and the root of
a repo created in the top dir of a volume is '<volume>:\', i.e.:
'C:\file' and 'C:\' respectively, this patch fixes the problem on POSIX
but the issue still stands on Windows.
3. if absolute paths are in the form '<volume>:\<path>' and the root of
a repo created in the top dir of a volume is '<volume>:', i.e.:
'C:\file' and 'C:'(note the lack of slash) respectively, this patch
fixes the problem on POSIX. The issue was not present on Windows nor
this patch introduces a regression.
My guess is the right answer is the number 2, but I would be grateful if
someone could create a repo on the top dir of a volume and let me know
the content of the 'Root:' line in the output of `darcs show repo`.
PS: 'direction' (forward or backward) of the slashes is irrelevant as,
if I've read correctly the code, all backward slashes are transformed to
forward ones before comparing the paths.