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
This commit is contained in:
Joey Hess 2021-07-30 18:36:03 -04:00
parent 9f94d2894e
commit b3c4579c79
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 33 additions and 20 deletions

View file

@ -47,7 +47,7 @@ findOrGenUUID = do
else ifM (Annex.Branch.hasSibling <||> (isJust <$> Fields.getField Fields.autoInit))
( do
liftIO checkNotReadOnly
initialize Nothing Nothing
initialize True Nothing Nothing
getUUID
, return NoUUID
)

View file

@ -70,7 +70,7 @@ perform os = do
Just v | v /= wantversion ->
giveup $ "This repository is already a initialized with version " ++ show (fromRepoVersion v) ++ ", not changing to requested version."
_ -> noop
initialize
initialize False
(if null (initDesc os) then Nothing else Just (initDesc os))
(initVersion os)
Annex.SpecialRemote.autoEnable

View file

@ -35,6 +35,6 @@ perform s = do
then return $ toUUID s
else Remote.nameToUUID s
storeUUID u
initialize' Nothing
initialize' False Nothing
Annex.SpecialRemote.autoEnable
next $ return True

View file

@ -45,6 +45,6 @@ start (UpgradeOptions { autoOnly = True }) =
start _ =
starting "upgrade" (ActionItemOther Nothing) (SeekInput []) $ do
whenM (isNothing <$> getVersion) $ do
initialize Nothing Nothing
initialize False Nothing Nothing
r <- upgrade False latestVersion
next $ return r