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 Command
|
|
|
|
import Annex.Init
|
|
|
|
import Annex.UUID
|
|
|
|
import qualified Remote
|
2015-09-14 18:49:48 +00:00
|
|
|
import qualified Annex.SpecialRemote
|
2014-04-16 00:13:35 +00:00
|
|
|
|
2015-07-08 19:08:02 +00:00
|
|
|
cmd :: Command
|
2015-07-08 16:33:27 +00:00
|
|
|
cmd = dontCheck repoExists $
|
2015-07-08 19:08:02 +00:00
|
|
|
command "reinit" SectionUtility
|
|
|
|
"initialize repository, reusing old UUID"
|
|
|
|
(paramUUID ++ "|" ++ paramDesc)
|
|
|
|
(withParams seek)
|
2014-04-16 00:13:35 +00:00
|
|
|
|
2015-07-08 19:08:02 +00:00
|
|
|
seek :: CmdParams -> CommandSeek
|
2014-04-16 00:13:35 +00:00
|
|
|
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
|
2015-12-15 21:17:13 +00:00
|
|
|
initialize' Nothing
|
2015-09-14 18:49:48 +00:00
|
|
|
Annex.SpecialRemote.autoEnable
|
2014-04-16 00:13:35 +00:00
|
|
|
next $ return True
|