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
|
2018-10-01 18:12:06 +00:00
|
|
|
seek = withWords (commandAction . start)
|
2014-04-16 00:13:35 +00:00
|
|
|
|
|
|
|
start :: [String] -> CommandStart
|
|
|
|
start ws = do
|
2017-11-28 18:40:26 +00:00
|
|
|
showStart' "reinit" (Just s)
|
2014-04-16 00:13:35 +00:00
|
|
|
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
|
2019-02-05 18:43:23 +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
|