migrate: Fix failure to migrate from URL keys. (Reversion introduced in version 6.20180926)

This commit is contained in:
Joey Hess 2018-10-29 16:26:43 -04:00
parent d73f92d8bc
commit 4431b82bce
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 63 additions and 13 deletions

View file

@ -82,18 +82,18 @@ perform file oldkey oldbackend newbackend = go =<< genkey (fastMigrate oldbacken
next $ Command.ReKey.cleanup file oldkey newkey
, giveup "failed creating link from old to new key"
)
genkey Nothing = return Nothing
genkey Nothing = do
content <- calcRepo $ gitAnnexLocation oldkey
let source = KeySource
{ keyFilename = file
, contentLocation = content
, inodeCache = Nothing
}
v <- genKey source (Just newbackend)
return $ case v of
Just (newkey, _) -> Just (newkey, False)
_ -> Nothing
genkey (Just fm) = fm oldkey newbackend afile >>= \case
Just newkey -> return $ Just (newkey, True)
Nothing -> do
content <- calcRepo $ gitAnnexLocation oldkey
let source = KeySource
{ keyFilename = file
, contentLocation = content
, inodeCache = Nothing
}
v <- genKey source (Just newbackend)
return $ case v of
Just (newkey, _) -> Just (newkey, False)
_ -> Nothing
Just newkey -> return (Just (newkey, True))
Nothing -> genkey Nothing
afile = AssociatedFile (Just file)