summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Committer.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-11 15:14:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-11 15:14:42 -0400
commitb2f04c1ed094aec6f734103d50077c48f3aad2a9 (patch)
tree064012fec3e955f1422a6b05ad075894ea6c755b /Assistant/Threads/Committer.hs
parentee98604d9463da1abadd0a9490f90a8bce358279 (diff)
synthesize RmChange when a directory is deleted
This gets directory renames closer to being fully detected. There's close to no extra overhead to doing it this way.
Diffstat (limited to 'Assistant/Threads/Committer.hs')
-rw-r--r--Assistant/Threads/Committer.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index f1e26f9aa..0d9010cb7 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -80,7 +80,7 @@ waitChangeTime a = runEvery (Seconds 1) <~> do
changes <- getChanges
-- See if now's a good time to commit.
now <- liftIO getCurrentTime
- case (shouldCommit now changes, lonelychange changes) of
+ case (shouldCommit now changes, possiblyrename changes) of
(True, False) -> a (changes, now)
(True, True) -> do
-- Wait for other, related changes to arrive.
@@ -92,10 +92,13 @@ waitChangeTime a = runEvery (Seconds 1) <~> do
_ -> refill changes
where
{- Did we perhaps only get one of the AddChange and RmChange pair
- - that make up a rename? -}
- lonelychange [(PendingAddChange _ _)] = True
- lonelychange [c] | isRmChange c = True
- lonelychange _ = False
+ - that make up a file rename? Or some of the pairs that make up
+ - a directory rename?
+ -}
+ possiblyrename cs = all renamepart cs
+
+ renamepart (PendingAddChange _ _) = True
+ renamepart c = isRmChange c
isRmChange :: Change -> Bool
isRmChange (Change { changeInfo = i }) | i == RmChange = True