git-annex/Command/Reinit.hs
Joey Hess 7d0e79b9e1
Use git-annex init --version=6 to get v6 for now
Not ready to make it default because of the direct mode upgrade needing to
all happen at once.
2015-12-15 17:17:13 -04:00

43 lines
862 B
Haskell

{- git-annex command
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Reinit where
import Common.Annex
import Command
import Annex.Init
import Annex.UUID
import Types.UUID
import qualified Remote
import qualified Annex.SpecialRemote
cmd :: Command
cmd = dontCheck repoExists $
command "reinit" SectionUtility
"initialize repository, reusing old UUID"
(paramUUID ++ "|" ++ paramDesc)
(withParams seek)
seek :: CmdParams -> CommandSeek
seek = withWords start
start :: [String] -> CommandStart
start ws = do
showStart "reinit" s
next $ perform s
where
s = unwords ws
perform :: String -> CommandPerform
perform s = do
u <- if isUUID s
then return $ toUUID s
else Remote.nameToUUID s
storeUUID u
initialize' Nothing
Annex.SpecialRemote.autoEnable
next $ return True