fix case where keys db was not initialized in time
authorJoey Hess <joeyh@joeyh.name>
Mon, 24 May 2021 18:46:59 +0000 (14:46 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 24 May 2021 18:46:59 +0000 (14:46 -0400)
commitf46e4c9b7c90267c38d44354bf690ce07f761182
treef1a58b63dd6d2ea09aef8ab5fecb305e3dbdf293
parenta56b151f9009590c97da8dbf66c1b138455657cb
fix case where keys db was not initialized in time

When the keys db is opened for read, and did not exist yet, it used to
skip creating it, and return mempty values. But that prevents
reconcileStaged from populating associated files information in time for
the read. This fixes the one remaining case I know of where
the fix in a56b151f9009590c97da8dbf66c1b138455657cb didn't work.

Note that, when there is a permissions error, it still avoids creating
the db and returns mempty for all queries. This does mean that
reconcileStaged does not run and so it may want to drop files that it
should not. However, presumably a permissions error on the keys database
also means that the user does not have permission to delete annex
objects, so they won't be able to drop the files anyway.

Sponsored-by: Dartmouth College's Datalad project
Annex/Wanted.hs
Database/Keys.hs