autoinit on upgrade

This commit is contained in:
Joey Hess 2016-03-31 17:20:43 -04:00
parent 11935c4d6f
commit f08149207c
Failed to extract signature

View file

@ -9,6 +9,8 @@ module Command.Upgrade where
import Command import Command
import Upgrade import Upgrade
import Annex.Version
import Annex.Init
cmd :: Command cmd :: Command
cmd = dontCheck repoExists $ -- because an old version may not seem to exist cmd = dontCheck repoExists $ -- because an old version may not seem to exist
@ -22,5 +24,7 @@ seek = withNothing start
start :: CommandStart start :: CommandStart
start = do start = do
showStart "upgrade" "." showStart "upgrade" "."
whenM (isNothing <$> getVersion) $ do
initialize Nothing Nothing
r <- upgrade False r <- upgrade False
next $ next $ return r next $ next $ return r