From dc748c7336aea9cbf04c0311098a44c2b329633d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Apr 2014 20:13:35 -0400 Subject: reinit: New command that can initialize a new reposotory using the configuration of a previously known repository. Useful if a repository got deleted and you want to clone it back the way it was. --- Command/Reinit.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Command/Reinit.hs (limited to 'Command/Reinit.hs') diff --git a/Command/Reinit.hs b/Command/Reinit.hs new file mode 100644 index 000000000..0fc1e8314 --- /dev/null +++ b/Command/Reinit.hs @@ -0,0 +1,38 @@ +{- git-annex command + - + - Copyright 2014 Joey Hess + - + - 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 + +def :: [Command] +def = [dontCheck repoExists $ + 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 -- cgit v1.2.3