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:
parent
9f94d2894e
commit
b3c4579c79
9 changed files with 33 additions and 20 deletions
|
@ -96,8 +96,8 @@ genDescription Nothing = do
|
|||
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
|
||||
|
@ -107,7 +107,7 @@ initialize mdescription mversion = checkInitializeAllowed $ do
|
|||
ensureCommit $ Annex.Branch.create
|
||||
|
||||
prepUUID
|
||||
initialize' mversion
|
||||
initialize' autoinit mversion
|
||||
|
||||
initSharedClone sharedclone
|
||||
|
||||
|
@ -119,8 +119,8 @@ initialize mdescription mversion = checkInitializeAllowed $ do
|
|||
|
||||
-- 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
|
||||
|
@ -135,9 +135,11 @@ initialize' mversion = checkInitializeAllowed $ do
|
|||
then configureSmudgeFilter
|
||||
else deconfigureSmudgeFilter
|
||||
unlessM isBareRepo $ do
|
||||
scanAnnexedFiles
|
||||
hookWrite postCheckoutHook
|
||||
hookWrite postMergeHook
|
||||
unless autoinit $
|
||||
scanAnnexedFiles
|
||||
|
||||
AdjustedBranch.checkAdjustedClone >>= \case
|
||||
AdjustedBranch.InAdjustedClone -> return ()
|
||||
AdjustedBranch.NotInAdjustedClone ->
|
||||
|
@ -198,7 +200,7 @@ ensureInitialized = getInitializedVersion >>= maybe needsinit checkUpgrade
|
|||
where
|
||||
needsinit = ifM autoInitializeAllowed
|
||||
( do
|
||||
initialize Nothing Nothing
|
||||
initialize True Nothing Nothing
|
||||
autoEnableSpecialRemotes
|
||||
, giveup "First run: git-annex init"
|
||||
)
|
||||
|
@ -232,7 +234,7 @@ autoInitialize = getInitializedVersion >>= maybe needsinit checkUpgrade
|
|||
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. -}
|
||||
|
|
|
@ -58,10 +58,10 @@ ifAnnexed file yes no = maybe no yes =<< lookupKey file
|
|||
- 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)
|
||||
|
|
|
@ -85,7 +85,7 @@ initRepo False _ dir desc mgroup = inDir dir $ do
|
|||
|
||||
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
|
||||
|
|
|
@ -23,6 +23,9 @@ git-annex (8.20210715) UNRELEASED; urgency=medium
|
|||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,4 +6,12 @@ If any other git-annex command is run before the get, it avoids the
|
|||
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]]
|
||||
|
|
Loading…
Add table
Reference in a new issue