make upgrade more robust

don't remove .git-annex until state has been succeffully saved
This commit is contained in:
Joey Hess 2011-07-05 15:06:20 -04:00
parent d31b84c777
commit d360ca3ed9

View file

@ -54,11 +54,13 @@ upgrade = do
when e $ do
mapM_ (\(k, f) -> inject f $ logFile k) =<< locationLogs g
mapM_ (\f -> inject f f) =<< logFiles (olddir g)
liftIO $ do
Git.run g "rm" [Param "-r", Param "-f", Param "-q", File (olddir g)]
unless bare $ gitAttributesUnWrite g
saveState
when e $ liftIO $ do
Git.run g "rm" [Param "-r", Param "-f", Param "-q", File (olddir g)]
unless bare $ gitAttributesUnWrite g
unless bare $ push
return True