Windows: Fix v6 unlocked files to actually work.

Pointer files were not being treated as annex content, so "git annex get"
didn't replace them with the object.
This commit is contained in:
Joey Hess 2016-02-15 16:12:18 -04:00
parent dcf42949cb
commit f9d79d194b
Failed to extract signature
4 changed files with 19 additions and 10 deletions

View file

@ -12,6 +12,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Annex.Link where
import Annex.Common
@ -155,3 +157,18 @@ formatPointer k =
isPointerFile :: FilePath -> IO (Maybe Key)
isPointerFile f = catchDefaultIO Nothing $
parseLinkOrPointer <$> L.readFile f
{- Checks a symlink target or pointer file first line to see if it
- appears to point to annexed content.
-
- We only look for paths inside the .git directory, and not at the .git
- directory itself, because GIT_DIR may cause a directory name other
- than .git to be used.
-}
isLinkToAnnex :: FilePath -> Bool
isLinkToAnnex s = (pathSeparator:objectDir) `isInfixOf` s
#ifdef mingw32_HOST_OS
-- '/' is still used inside pointer files on Windows, not the native
-- '\'
|| ('/':objectDir) `isInfixOf` s
#endif