catch exceptions in upgrade

Exceptions due to eg, not being able to write to the repo are not very
useful. There tends to be an error message from git about permission
denied.
This commit is contained in:
Joey Hess 2019-08-27 12:32:44 -04:00
parent 3a0842d9f8
commit 37b42e72e7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -32,12 +32,12 @@ import Annex.AdjustedBranch
import qualified Data.ByteString as S import qualified Data.ByteString as S
upgrade :: Bool -> Annex Bool upgrade :: Bool -> Annex Bool
upgrade automatic = do upgrade automatic = flip catchNonAsync (const $ return False) $ do
unless automatic $ unless automatic $
showAction "v5 to v6" showAction "v5 to v6"
ifM isDirect ifM isDirect
( do ( do
convertDirect automatic convertDirect
-- Worktree files are already populated, so don't -- Worktree files are already populated, so don't
-- have this try to populate them again. -- have this try to populate them again.
scanUnlockedFiles False scanUnlockedFiles False
@ -52,8 +52,8 @@ upgrade automatic = do
createInodeSentinalFile True createInodeSentinalFile True
return True return True
convertDirect :: Bool -> Annex () convertDirect :: Annex ()
convertDirect automatic = do convertDirect = do
{- Direct mode makes the same tradeoff of using less disk {- Direct mode makes the same tradeoff of using less disk
- space, with less preservation of old versions of files - space, with less preservation of old versions of files
- as does annex.thin. -} - as does annex.thin. -}