use RawFilePath getSymbolicLinkStatus for speed
This commit is contained in:
parent
db13b16013
commit
a0168cd9a2
3 changed files with 9 additions and 3 deletions
|
@ -33,6 +33,7 @@ import Annex.CurrentBranch
|
|||
import Annex.Content
|
||||
import Annex.InodeSentinal
|
||||
import qualified Database.Keys
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
withFilesInGit :: (RawFilePath -> CommandSeek) -> [WorkTreeItem] -> CommandSeek
|
||||
withFilesInGit a l = seekActions $ prepFiltered a $
|
||||
|
@ -276,4 +277,4 @@ workTreeItems' (AllowHidden allowhidden) ps = do
|
|||
| otherwise = return False
|
||||
|
||||
notSymlink :: RawFilePath -> IO Bool
|
||||
notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus (fromRawFilePath f)
|
||||
notSymlink f = liftIO $ not . isSymbolicLink <$> R.getSymbolicLinkStatus f
|
||||
|
|
|
@ -19,6 +19,7 @@ import Annex.Link
|
|||
import Annex.Tmp
|
||||
import Messages.Progress
|
||||
import Git.FilePath
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $
|
||||
|
@ -92,7 +93,7 @@ start file = do
|
|||
maybe go fixuppointer mk
|
||||
where
|
||||
go = ifAnnexed file addpresent add
|
||||
add = liftIO (catchMaybeIO $ getSymbolicLinkStatus (fromRawFilePath file)) >>= \case
|
||||
add = liftIO (catchMaybeIO $ R.getSymbolicLinkStatus file) >>= \case
|
||||
Nothing -> stop
|
||||
Just s
|
||||
| not (isRegularFile s) && not (isSymbolicLink s) -> stop
|
||||
|
@ -102,7 +103,7 @@ start file = do
|
|||
then next $ addFile file
|
||||
else perform file
|
||||
addpresent key =
|
||||
liftIO (catchMaybeIO $ getSymbolicLinkStatus $ fromRawFilePath file) >>= \case
|
||||
liftIO (catchMaybeIO $ R.getSymbolicLinkStatus file) >>= \case
|
||||
Just s | isSymbolicLink s -> fixuplink key
|
||||
_ -> add
|
||||
fixuplink key = starting "add" (ActionItemWorkTreeFile file) $ do
|
||||
|
|
|
@ -18,6 +18,7 @@ module Utility.RawFilePath (
|
|||
RawFilePath,
|
||||
readSymbolicLink,
|
||||
getFileStatus,
|
||||
getSymbolicLinkStatus,
|
||||
) where
|
||||
|
||||
#ifndef mingw32_HOST_OS
|
||||
|
@ -33,4 +34,7 @@ readSymbolicLink f = toRawFilePath <$> P.readSymbolicLink (fromRawFilePath f)
|
|||
|
||||
getFileStatus :: RawFilePath -> IO FileStatus
|
||||
getFileStatus = P.getFileStatus . fromRawFilePath
|
||||
|
||||
getSymbolicLinkStatus :: RawFilePath -> IO FileStatus
|
||||
getSymbolicLinkStatus = P.getSymbolicLinkStatus . fromRawFilePath
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue