summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Watcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-13 14:27:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-13 14:27:17 -0400
commit220d54ffbd0d3d3bba8662d1964c02fe1a44cb38 (patch)
treeb89a849426018b29239de3d94fdc9db19ca5295f /Assistant/Threads/Watcher.hs
parent80742af4abedd516c458ec337495383e41d6f60c (diff)
assistant: Notice on startup when the index file is corrupt, and auto-repair.
Diffstat (limited to 'Assistant/Threads/Watcher.hs')
-rw-r--r--Assistant/Threads/Watcher.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs
index 3eedbe145..6a56eadbb 100644
--- a/Assistant/Threads/Watcher.hs
+++ b/Assistant/Threads/Watcher.hs
@@ -200,6 +200,9 @@ onAdd matcher file filestatus
add matcher file
| otherwise = noChange
+shouldRestage :: DaemonStatus -> Bool
+shouldRestage ds = scanComplete ds || forceRestage ds
+
{- In direct mode, add events are received for both new files, and
- modified existing files.
-}
@@ -214,7 +217,7 @@ onAddDirect symlinkssupported matcher file fs = do
- really modified, but it might have
- just been deleted and been put back,
- so it symlink is restaged to make sure. -}
- ( ifM (scanComplete <$> getDaemonStatus)
+ ( ifM (shouldRestage <$> getDaemonStatus)
( do
link <- liftAnnex $ inRepo $ gitAnnexLink file key
addLink file link (Just key)
@@ -286,7 +289,7 @@ onAddSymlink' linktarget mk isdirect file filestatus = go mk
- links too.)
-}
ensurestaged (Just link) daemonstatus
- | scanComplete daemonstatus = addLink file link mk
+ | shouldRestage daemonstatus = addLink file link mk
| otherwise = case filestatus of
Just s
| not (afterLastDaemonRun (statusChangeTime s) daemonstatus) -> noChange