avoid closeDb opening the db if it's not already open

This commit is contained in:
Joey Hess 2018-10-30 22:19:05 -04:00
parent b144622d0d
commit fcc9eea554
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -151,7 +151,9 @@ openDb createdb _ = catchPermissionDenied permerr $ withExclusiveLock gitAnnexKe
- data to it.
-}
closeDb :: Annex ()
closeDb = liftIO . closeDbHandle =<< getDbHandle
closeDb = Annex.getState Annex.keysdbhandle >>= \case
Nothing -> return ()
Just h -> liftIO (closeDbHandle h)
addAssociatedFile :: Key -> TopFilePath -> Annex ()
addAssociatedFile k f = runWriterIO $ SQL.addAssociatedFile (toIKey k) f