rename key2file and file2key

What these generate is not really suitable to be used as a filename,
which is why keyFile and fileKey further escape it. These are just
serializing Keys.

Also removed a quickcheck test that was very unlikely to test anything
useful, since it relied on random chance creating something that looks
like a serialized key. The other test is sufficient for testing what
that was intended to test anyway.
This commit is contained in:
Joey Hess 2019-01-14 13:03:35 -04:00
parent ff0a2bee2d
commit d3ab5e626b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
40 changed files with 97 additions and 108 deletions

View file

@ -197,7 +197,7 @@ checkKey r k = do
{- glacier checkpresent outputs the archive name to stdout if
- it's present. -}
s <- liftIO $ readProcessEnv "glacier" (toCommand params) (Just e)
let probablypresent = key2file k `elem` lines s
let probablypresent = serializeKey k `elem` lines s
if probablypresent
then ifM (Annex.getFlag "trustglacier")
( return True, giveup untrusted )
@ -253,7 +253,7 @@ getVault = fromMaybe (giveup "Missing vault configuration")
. M.lookup "vault"
archive :: Remote -> Key -> Archive
archive r k = fileprefix ++ key2file k
archive r k = fileprefix ++ serializeKey k
where
fileprefix = M.findWithDefault "" "fileprefix" $ config r
@ -306,7 +306,7 @@ jobList r keys = go =<< glacierEnv (config r) (gitconfig r) (uuid r)
parse c [] = c
parse c@(succeeded, failed) ((status:_date:vault:key:[]):rest)
| vault == myvault =
case file2key key of
case deserializeKey key of
Nothing -> parse c rest
Just k
| "a/d" `isPrefixOf` status ->