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