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
428c91606b434512d1986622e751c795edf4df44 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
Right username -> [username, at, hostname, ":", reldir]
Left _ -> [hostname, ":", reldir]
-initialize :: Maybe String -> Maybe RepoVersion -> Annex ()
-initialize mdescription mversion = checkInitializeAllowed $ do
+initialize :: Bool -> Maybe String -> Maybe RepoVersion -> Annex ()
+initialize autoinit mdescription mversion = checkInitializeAllowed $ do
{- Has to come before any commits are made as the shared
- clone heuristic expects no local objects. -}
sharedclone <- checkSharedClone
ensureCommit $ Annex.Branch.create
prepUUID
- initialize' mversion
+ initialize' autoinit mversion
initSharedClone sharedclone
-
+
u <- getUUID
{- Avoid overwriting existing description with a default
- description. -}
-- Everything except for uuid setup, shared clone setup, and initial
-- description.
-initialize' :: Maybe RepoVersion -> Annex ()
-initialize' mversion = checkInitializeAllowed $ do
+initialize' :: Bool -> Maybe RepoVersion -> Annex ()
+initialize' autoinit mversion = checkInitializeAllowed $ do
checkLockSupport
checkFifoSupport
checkCrippledFileSystem
then configureSmudgeFilter
else deconfigureSmudgeFilter
unlessM isBareRepo $ do
- scanAnnexedFiles
hookWrite postCheckoutHook
hookWrite postMergeHook
+ unless autoinit $
+ scanAnnexedFiles
+
AdjustedBranch.checkAdjustedClone >>= \case
AdjustedBranch.InAdjustedClone -> return ()
AdjustedBranch.NotInAdjustedClone ->
where
needsinit = ifM autoInitializeAllowed
( do
- initialize Nothing Nothing
+ initialize True Nothing Nothing
autoEnableSpecialRemotes
, giveup "First run: git-annex init"
)
where
needsinit =
whenM (initializeAllowed <&&> autoInitializeAllowed) $ do
- initialize Nothing Nothing
+ initialize True Nothing Nothing
autoEnableSpecialRemotes
{- Checks if a repository is initialized. Does not check version for ugrade. -}
- Normally the keys database is updated incrementally when it's being
- opened, and changes are noticed. Calling this explicitly allows
- running the update at an earlier point.
+ -
+ - All that needs to be done is to open the database,
+ - that will result in Database.Keys.reconcileStaged
+ - running, and doing the work.
-}
scanAnnexedFiles :: Annex ()
-scanAnnexedFiles =
- -- All that needs to be done is to open the database,
- -- that will result in Database.Keys.reconcileStaged
- -- running, and doing the work.
- Database.Keys.runWriter (const noop)
+scanAnnexedFiles = Database.Keys.runWriter (const noop)
initRepo' :: Maybe String -> Maybe StandardGroup -> Annex ()
initRepo' desc mgroup = unlessM isInitialized $ do
- initialize desc Nothing
+ initialize False desc Nothing
u <- getUUID
maybe noop (defaultStandardGroup u) mgroup
{- Ensure branch gets committed right away so it is
in a repository that was upgraded from v7.
* fsck: Detect and correct stale or missing inode caches.
* Fix a rounding bug in display of data sizes.
+ * 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)
-- Joey Hess <id@joeyh.name> Wed, 14 Jul 2021 14:26:36 -0400
else ifM (Annex.Branch.hasSibling <||> (isJust <$> Fields.getField Fields.autoInit))
( do
liftIO checkNotReadOnly
- initialize Nothing Nothing
+ initialize True Nothing Nothing
getUUID
, return NoUUID
)
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
then return $ toUUID s
else Remote.nameToUUID s
storeUUID u
- initialize' Nothing
+ initialize' False Nothing
Annex.SpecialRemote.autoEnable
next $ return 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
problem. So the problem has to do with autoinit followed by reading
associated files from the keys db.
-Besected to [[!commit 428c91606b434512d1986622e751c795edf4df44]] --[[Joey]]
+Bisected to [[!commit 428c91606b434512d1986622e751c795edf4df44]] --[[Joey]]
+
+It seems that reconcileStaged is populating the
+associated files, but later when they're queried, the query returns an
+empty list. So something to do with database write caching.
+
+Somehow, not having init call `scanAnnexedFiles` makes this bug go away.
+
+> [[fixed|done]] --[[Joey]]