eliminating absNormPath

git-annex has been using MissingH's `abdNormPath` forever, but that's
unmaintained and possibly buggy, and doesn't work on Windows. I've been
wanting to get rid of it for some time, and finally did today, writing a
`simplifyPath` that does the things git-annex needs and will work with all
the Windows filename craziness, and takes advantage of the more modern
System.FilePath to be quite a simple peice of code. A QuickCheck test found
no important divergences from absNormPath. A good first step to making
git-annex not depend on MissingH at all.

And it fixed some weird behaviors on Windows like
`git annex add ..\subdir\file` not working.

Note that absNormPathUnix has been left alone for now.
This commit is contained in:
Joey Hess 2014-02-07 17:10:51 -04:00
parent cb8dfe8dd3
commit ae2bc90a1d
2 changed files with 37 additions and 29 deletions

View file

@ -1071,14 +1071,10 @@ test_add_subdirs env = intmpclonerepo env $ do
l <- annexeval $ encodeW8 . L.unpack <$> Annex.CatFile.catObject (Git.Types.Ref "HEAD:dir/foo")
"../.git/annex/" `isPrefixOf` l @? ("symlink from subdir to .git/annex is wrong: " ++ l)
#ifndef mingw32_HOST_OS
{- This does not work on Windows, for whatever reason. -}
createDirectory "dir2"
writeFile ("dir2" </> "foo") $ content annexedfile
setCurrentDirectory "dir"
git_annex env "add" [".." </> "dir2"] @? "add of ../subdir failed"
#endif
-- This is equivilant to running git-annex, but it's all run in-process
-- (when the OS allows) so test coverage collection works.