summaryrefslogtreecommitdiff
path: root/Database
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-01 15:16:16 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-01 15:16:16 -0400
commit686fc71dbddff72fa7a0e33d7dabad469bc620e4 (patch)
tree060dcf85a6826ed3127f85296c12b8843503797e /Database
parentcf8d7fa046cf66a4ac75b9d56b48776891b65863 (diff)
only do scan when there's a branch, not in freshly created new repo
Diffstat (limited to 'Database')
-rw-r--r--Database/Keys.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/Database/Keys.hs b/Database/Keys.hs
index 30e6ff921..0cd7401be 100644
--- a/Database/Keys.hs
+++ b/Database/Keys.hs
@@ -38,6 +38,7 @@ import Utility.InodeCache
import Annex.InodeSentinal
import qualified Git.Types
import qualified Git.LsTree
+import qualified Git.Branch
import Git.Ref
import Git.FilePath
import Annex.CatFile
@@ -214,14 +215,15 @@ removeAssociatedFile' sk f = queueDb $
{- Find all unlocked associated files. This is expensive, and so normally
- the associated files are updated incrementally when changes are noticed. -}
scanAssociatedFiles :: Annex ()
-scanAssociatedFiles = runWriter $ \h -> do
- showSideAction "scanning for unlocked files"
- dropallassociated h
- l <- inRepo $ Git.LsTree.lsTree headRef
- forM_ l $ \i ->
- when (isregfile i) $
- maybe noop (add h i)
- =<< catKey (Git.Types.Ref $ Git.LsTree.sha i)
+scanAssociatedFiles = whenM (isJust <$> inRepo Git.Branch.current) $
+ runWriter $ \h -> do
+ showSideAction "scanning for unlocked files"
+ dropallassociated h
+ l <- inRepo $ Git.LsTree.lsTree headRef
+ forM_ l $ \i ->
+ when (isregfile i) $
+ maybe noop (add h i)
+ =<< catKey (Git.Types.Ref $ Git.LsTree.sha i)
where
dropallassociated = queueDb $
delete $ from $ \(_r :: SqlExpr (Entity Associated)) ->