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:
Joey Hess 2019-12-06 14:44:42 -04:00
parent 0e9d699ef3
commit 5f391179f1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 36 additions and 21 deletions

View file

@ -56,7 +56,7 @@ performNew :: RawFilePath -> Key -> CommandPerform
performNew file key = do
lockdown =<< calcRepo (gitAnnexLocation key)
addLink (fromRawFilePath file) key
=<< withTSDelta (liftIO . genInodeCache (fromRawFilePath file))
=<< withTSDelta (liftIO . genInodeCache' file)
next $ cleanupNew file key
where
lockdown obj = do
@ -70,7 +70,7 @@ performNew file key = do
-- It's ok if the file is hard linked to obj, but if some other
-- associated file is, we need to break that link to lock down obj.
breakhardlink obj = whenM (catchBoolIO $ (> 1) . linkCount <$> liftIO (getFileStatus obj)) $ do
mfc <- withTSDelta (liftIO . genInodeCache (fromRawFilePath file))
mfc <- withTSDelta (liftIO . genInodeCache' file)
unlessM (sameInodeCache obj (maybeToList mfc)) $ do
modifyContent obj $ replaceFile obj $ \tmp -> do
unlessM (checkedCopyFile key obj tmp Nothing) $