3cc94c1667
A top-level .noannex file will prevent git-annex init from being used in a repository. This is useful for repositories that have a policy reason not to use git-annex. The content of the file will be displayed to the user who tries to run git-annex init. This also affects git annex reinit and initialization via the webapp. It does not affect automatic inits, when there's a sibling git-annex branch already. This commit was supported by the NSF-funded DataLad project.
41 lines
849 B
Haskell
41 lines
849 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 Command
|
|
import Annex.Init
|
|
import Annex.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" (Just 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' (AutoInit False) Nothing
|
|
Annex.SpecialRemote.autoEnable
|
|
next $ return True
|