use RawFilePath getFileStatus for speed
Only done on those calls to getFileStatus that had a RawFilePath, not a FilePath. The others would probably be just as fast if converted to use it with toRawFilePath, but I'm not 100% sure. Note that genInodeCache' uses fromRawFilePath, but that value only gets used on Windows, so on unix the thunk will never be evaluated.
This commit is contained in:
parent
0e9d699ef3
commit
5f391179f1
9 changed files with 36 additions and 21 deletions
|
@ -19,6 +19,7 @@ import Git.FilePath
|
|||
import qualified Database.Keys
|
||||
import Annex.InodeSentinal
|
||||
import Utility.InodeCache
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "rekey" SectionPlumbing
|
||||
|
@ -89,14 +90,14 @@ linkKey file oldkey newkey = ifM (isJust <$> isAnnexLink file)
|
|||
- it's hard linked to the old key, that link must be broken. -}
|
||||
oldobj <- calcRepo (gitAnnexLocation oldkey)
|
||||
v <- tryNonAsync $ do
|
||||
st <- liftIO $ getFileStatus (fromRawFilePath file)
|
||||
st <- liftIO $ R.getFileStatus file
|
||||
when (linkCount st > 1) $ do
|
||||
freezeContent oldobj
|
||||
replaceFile (fromRawFilePath file) $ \tmp -> do
|
||||
unlessM (checkedCopyFile oldkey oldobj tmp Nothing) $
|
||||
error "can't lock old key"
|
||||
thawContent tmp
|
||||
ic <- withTSDelta (liftIO . genInodeCache (fromRawFilePath file))
|
||||
ic <- withTSDelta (liftIO . genInodeCache' file)
|
||||
case v of
|
||||
Left e -> do
|
||||
warning (show e)
|
||||
|
@ -117,7 +118,7 @@ cleanup file oldkey newkey = do
|
|||
liftIO $ removeFile (fromRawFilePath file)
|
||||
addLink (fromRawFilePath file) newkey Nothing
|
||||
, do
|
||||
mode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus (fromRawFilePath file)
|
||||
mode <- liftIO $ catchMaybeIO $ fileMode <$> R.getFileStatus file
|
||||
liftIO $ whenM (isJust <$> isPointerFile file) $
|
||||
writePointerFile file newkey mode
|
||||
stagePointerFile file mode =<< hashPointerFile newkey
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue