push RawFilePath down into Annex.ReplaceFile

Minor optimisation, but a win in every case, except for a couple where
it's a wash.

Note that replaceFile still takes a FilePath, because it needs to
operate on Chars to truncate unicode filenames properly.
This commit is contained in:
Joey Hess 2023-10-26 13:36:49 -04:00
parent c873586e14
commit d9fd205cbb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
12 changed files with 38 additions and 44 deletions

View file

@ -417,16 +417,15 @@ verifyWorkTree key file = do
Just k | k == key -> whenM (inAnnex key) $ do
showNote "fixing worktree content"
replaceWorkTreeFile (fromRawFilePath file) $ \tmp -> do
let tmp' = toRawFilePath tmp
mode <- liftIO $ catchMaybeIO $ fileMode <$> R.getFileStatus file
ifM (annexThin <$> Annex.getGitConfig)
( void $ linkFromAnnex' key tmp' mode
( void $ linkFromAnnex' key tmp mode
, do
obj <- calcRepo (gitAnnexLocation key)
void $ checkedCopyFile key obj tmp' mode
thawContent tmp'
void $ checkedCopyFile key obj tmp mode
thawContent tmp
)
Database.Keys.storeInodeCaches key [tmp']
Database.Keys.storeInodeCaches key [tmp]
_ -> return ()
return True