Merge branch 'bs' into sqlite-bs

This commit is contained in:
Joey Hess 2019-12-18 14:51:03 -04:00
commit d5628a16b8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
137 changed files with 827 additions and 516 deletions

View file

@ -17,6 +17,7 @@ import Database.Types
import Database.Handle
import qualified Database.Queue as H
import Utility.InodeCache
import Utility.FileSystemEncoding
import Git.FilePath
import Database.Persist.Sql hiding (Key)
@ -85,7 +86,7 @@ addAssociatedFile k f = queueDb $ do
deleteWhere [AssociatedFile ==. af, AssociatedKey !=. k]
void $ insertUnique $ Associated k af
where
af = toSFilePath (getTopFilePath f)
af = toSFilePath (fromRawFilePath (getTopFilePath f))
-- Does not remove any old association for a file, but less expensive
-- than addAssociatedFile. Calling dropAllAssociatedFiles first and then
@ -93,7 +94,7 @@ addAssociatedFile k f = queueDb $ do
addAssociatedFileFast :: Key -> TopFilePath -> WriteHandle -> IO ()
addAssociatedFileFast k f = queueDb $ void $ insertUnique $ Associated k af
where
af = toSFilePath (getTopFilePath f)
af = toSFilePath (fromRawFilePath (getTopFilePath f))
dropAllAssociatedFiles :: WriteHandle -> IO ()
dropAllAssociatedFiles = queueDb $
@ -104,7 +105,7 @@ dropAllAssociatedFiles = queueDb $
getAssociatedFiles :: Key -> ReadHandle -> IO [TopFilePath]
getAssociatedFiles k = readDb $ do
l <- selectList [AssociatedKey ==. k] []
return $ map (asTopFilePath . fromSFilePath . associatedFile . entityVal) l
return $ map (asTopFilePath . toRawFilePath . associatedFile . entityVal) l
{- Gets any keys that are on record as having a particular associated file.
- (Should be one or none but the database doesn't enforce that.) -}
@ -113,13 +114,13 @@ getAssociatedKey f = readDb $ do
l <- selectList [AssociatedFile ==. af] []
return $ map (associatedKey . entityVal) l
where
af = toSFilePath (getTopFilePath f)
af = toSFilePath (fromRawFilePath (getTopFilePath f))
removeAssociatedFile :: Key -> TopFilePath -> WriteHandle -> IO ()
removeAssociatedFile k f = queueDb $
deleteWhere [AssociatedKey ==. k, AssociatedFile ==. af]
where
af = toSFilePath (getTopFilePath f)
af = toSFilePath (fromRawFilePath (getTopFilePath f))
addInodeCaches :: Key -> [InodeCache] -> WriteHandle -> IO ()
addInodeCaches k is = queueDb $