import Annex.ReplaceFile
import Annex.CurrentBranch
import Annex.InodeSentinal
+import Annex.Concurrent
+import Utility.ThreadScheduler
import Utility.InodeCache
import Git.FilePath
import Git.CatFile
- But if worktree file does not have a pointer file's content, it is left
- as-is.
-}
-scanAnnexedFiles :: Annex ()
-scanAnnexedFiles = whenM (inRepo Git.Ref.headExists <&&> not <$> isBareRepo) $ do
+scanAnnexedFiles :: Bool -> Annex ()
+scanAnnexedFiles initscan = showSideActionAfter oneSecond "scanning for annexed files" $ do
-- This gets the keys database populated with all annexed files,
-- by running Database.Keys.reconcileStaged.
Database.Keys.runWriter (const noop)
-- annex object file already exists, but its inode is not yet
-- cached and annex.thin is set. So, the rest of this makes
-- another pass over the tree to do that.
- whenM (annexThin <$> Annex.getGitConfig) $ do
- g <- Annex.gitRepo
- (l, cleanup) <- inRepo $ Git.LsTree.lsTree
- Git.LsTree.LsTreeRecursive
- (Git.LsTree.LsTreeLong True)
- Git.Ref.headRef
- catObjectStreamLsTree l want g go
- liftIO $ void cleanup
+ whenM
+ ( pure initscan
+ <&&> annexThin <$> Annex.getGitConfig
+ <&&> inRepo Git.Ref.headExists
+ <&&> not <$> isBareRepo
+ ) $ do
+ g <- Annex.gitRepo
+ (l, cleanup) <- inRepo $ Git.LsTree.lsTree
+ Git.LsTree.LsTreeRecursive
+ (Git.LsTree.LsTreeLong True)
+ Git.Ref.headRef
+ catObjectStreamLsTree l want g go
+ liftIO $ void cleanup
where
-- Want to process symlinks, and regular files.
want i = case Git.Types.toTreeItemType (Git.LsTree.mode i) of
import Annex.FileMatcher
import Annex.Ingest
import Annex.CatFile
+import Annex.WorkTree
import Logs.Smudge
import Logs.Location
import qualified Database.Keys
update :: CommandStart
update = do
+ -- This gets run after a git checkout or merge, so it's a good
+ -- point to refresh the keys database for changes to annexed files.
+ -- Doing it explicitly here avoids a later pause in the middle of
+ -- some other action.
+ scanAnnexedFiles False
updateSmudged (Restage True)
stop
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2021-06-08T15:21:02Z"
+ content="""
+Made `git-annex smudge --update` run the scan, and so the post-checkout or
+post-merge hook will call it.
+
+That avoids the scenario shown above. But adding a lot of files to the
+index can still cause a later pause for reconcileStaged without indication
+what it's doing.
+"""]]