aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-11 15:24:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-11 15:24:13 -0400
commit9e2e6f8670422f77f86bf77cd644fddb5b777f44 (patch)
treedede32b3900c9d0f28ba06905fc614129c3f9198
parentdeb91f55f5ab2a846731163c0d20f81e7c9806e0 (diff)
detect directory rename and wait up to 1 second to get all the changes
-rw-r--r--Assistant/Threads/Committer.hs13
-rw-r--r--debian/changelog2
2 files changed, 12 insertions, 3 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 0d9010cb7..029ac94d2 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -80,13 +80,20 @@ waitChangeTime a = runEvery (Seconds 1) <~> do
changes <- getChanges
-- See if now's a good time to commit.
now <- liftIO getCurrentTime
+ debug ["got", show changes]
case (shouldCommit now changes, possiblyrename changes) of
(True, False) -> a (changes, now)
(True, True) -> do
- -- Wait for other, related changes to arrive.
- liftIO $ humanImperceptibleDelay
- -- Don't block, but are there any?
+ {- Wait for other, related changes to arrive.
+ - If there are multiple RmChanges, this is
+ - probably a directory rename, so wait a full
+ - second to get all the Changes involved. -}
+ liftIO $ if length (filter isRmChange changes) > 1
+ then threadDelaySeconds $ Seconds 1
+ else humanImperceptibleDelay
+ -- Don't block, but are there any new changes?
morechanges <- getAnyChanges
+ debug ["got more", show morechanges]
let allchanges = changes++morechanges
a (allchanges, now)
_ -> refill changes
diff --git a/debian/changelog b/debian/changelog
index 44d3bf68d..43475322d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -52,6 +52,8 @@ git-annex (4.20130228) UNRELEASED; urgency=low
Thanks, guilhem for the patch.
* assistant: Optimised handling of renamed files in direct mode,
avoiding re-checksumming.
+ * assistant: Detects most renames, including directory renames, and
+ combines all their changes into a single commit.
-- Joey Hess <joeyh@debian.org> Wed, 27 Feb 2013 23:20:40 -0400