The test suite was failing because of a bug in the Database/* modules.
I had replaced doesPathExist with doesDirectoryExist, but it was
checking the database file.
I have audited commit
f1ba21d698c908ad84c08bce24fbbc376190fe83 for
other changes to doesPathExist, and checked that doesDirectoryExist and
doesFileExist were used correctly.
The only change I found is in youtubeDl', where it used to return
directories that might have been created by youtube-dl. But it was
supposed to return media files, so changing it to use doesFileExist is
actually an improvement. Although only of theoretical benefit.
Note that it would actually be possible to keep using doesPathExist,
there is a version of that for OsPath as well. But the rest of these
changes seem safe.
Sponsored-by: Nicholas Golder-Manning
openDb = do
dbdir <- calcRepo' gitAnnexContentIdentifierDbDir
let db = dbdir </> literalOsPath "db"
- isnew <- liftIO $ not <$> doesDirectoryExist db
+ isnew <- liftIO $ not <$> doesFileExist db
if isnew
then initDb db $ void $
runMigrationSilent migrateContentIdentifier
openDb u = do
dbdir <- calcRepo' (gitAnnexExportDbDir u)
let db = dbdir </> literalOsPath "db"
- unlessM (liftIO $ doesDirectoryExist db) $ do
+ unlessM (liftIO $ doesFileExist db) $ do
initDb db $ void $
runMigrationSilent migrateExport
h <- liftIO $ H.openDbQueue db "exported"
openDb u = do
dbdir <- calcRepo' (gitAnnexFsckDbDir u)
let db = dbdir </> literalOsPath "db"
- unlessM (liftIO $ doesDirectoryExist db) $ do
+ unlessM (liftIO $ doesFileExist db) $ do
initDb db $ void $
runMigrationSilent migrateFsck
lockFileCached =<< calcRepo' (gitAnnexFsckDbLock u)
openDb = do
dbdir <- calcRepo' gitAnnexImportFeedDbDir
let db = dbdir </> literalOsPath "db"
- isnew <- liftIO $ not <$> doesDirectoryExist db
+ isnew <- liftIO $ not <$> doesFileExist db
when isnew $
initDb db $ void $
runMigrationSilent migrateImportFeed
catchPermissionDenied permerr $ withExclusiveLock lck $ do
dbdir <- calcRepo' gitAnnexKeysDbDir
let db = dbdir </> literalOsPath "db"
- dbexists <- liftIO $ doesDirectoryExist db
+ dbexists <- liftIO $ doesFileExist db
case dbexists of
True -> open db False
False -> do
openDb = lockDbWhile permerr $ do
dbdir <- calcRepo' gitAnnexRepoSizeDbDir
let db = dbdir </> literalOsPath "db"
- unlessM (liftIO $ doesDirectoryExist db) $ do
+ unlessM (liftIO $ doesFileExist db) $ do
initDb db $ void $
runMigrationSilent migrateRepoSizes
h <- liftIO $ H.openDb db "repo_sizes"