c3f47ba389
Avoid performing repository fixups for submodules and git-worktrees when there's a .noannex file that will prevent git-annex from being used in the repository. This change is ok as long as the .noannex file is really going to prevent git-annex from being used. But, init --force could override the file. Which would result in the repo being initialized without the fixups having run. To avoid that situation decided to change init, to not let --force be used to override a .noannex file. Instead the user can just delete the file.
41 lines
850 B
Haskell
41 lines
850 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 (commandAction . 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' Nothing
|
|
Annex.SpecialRemote.autoEnable
|
|
next $ return True
|