2014-04-16 00:13:35 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2014 Joey Hess <id@joeyh.name>
|
2014-04-16 00:13:35 +00:00
|
|
|
-
|
|
|
|
- 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
|
|
|
|
|
2014-10-14 18:20:10 +00:00
|
|
|
cmd :: [Command]
|
|
|
|
cmd = [dontCheck repoExists $
|
2014-04-16 00:13:35 +00:00
|
|
|
command "reinit" (paramUUID ++ " or " ++ paramDesc) seek SectionUtility ""]
|
|
|
|
|
|
|
|
seek :: 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'
|
|
|
|
next $ return True
|