git-annex/Command/Reinit.hs
Joey Hess b3c4579c79
work around strange auto-init bug
git-annex get when run as the first git-annex command in a new repo did not
populate unlocked files. (Reversion in version 8.20210621)

I am not entirely happy with this, because I don't understand how
428c91606b caused the problem in the first
place, and I don't fully understand how skipping calling scanAnnexedFiles
during autoinit avoids the problem.

Kept the explicit call to scanAnnexedFiles during git-annex init,
so that when reconcileStaged is expensive, it can be made to run then,
rather than at some later point when the information is needed.

Sponsored-by: Brock Spratlen on Patreon
2021-07-30 18:36:03 -04:00

40 lines
879 B
Haskell

{- git-annex command
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL 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 = starting "reinit" (ActionItemOther (Just s)) (SeekInput ws) $
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' False Nothing
Annex.SpecialRemote.autoEnable
next $ return True