detect directory rename and wait up to 1 second to get all the changes
This commit is contained in:
parent
1f4ba84979
commit
14fcfced48
2 changed files with 12 additions and 3 deletions
|
@ -80,13 +80,20 @@ waitChangeTime a = runEvery (Seconds 1) <~> do
|
||||||
changes <- getChanges
|
changes <- getChanges
|
||||||
-- See if now's a good time to commit.
|
-- See if now's a good time to commit.
|
||||||
now <- liftIO getCurrentTime
|
now <- liftIO getCurrentTime
|
||||||
|
debug ["got", show changes]
|
||||||
case (shouldCommit now changes, possiblyrename changes) of
|
case (shouldCommit now changes, possiblyrename changes) of
|
||||||
(True, False) -> a (changes, now)
|
(True, False) -> a (changes, now)
|
||||||
(True, True) -> do
|
(True, True) -> do
|
||||||
-- Wait for other, related changes to arrive.
|
{- Wait for other, related changes to arrive.
|
||||||
liftIO $ humanImperceptibleDelay
|
- If there are multiple RmChanges, this is
|
||||||
-- Don't block, but are there any?
|
- 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
|
morechanges <- getAnyChanges
|
||||||
|
debug ["got more", show morechanges]
|
||||||
let allchanges = changes++morechanges
|
let allchanges = changes++morechanges
|
||||||
a (allchanges, now)
|
a (allchanges, now)
|
||||||
_ -> refill changes
|
_ -> refill changes
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -52,6 +52,8 @@ git-annex (4.20130228) UNRELEASED; urgency=low
|
||||||
Thanks, guilhem for the patch.
|
Thanks, guilhem for the patch.
|
||||||
* assistant: Optimised handling of renamed files in direct mode,
|
* assistant: Optimised handling of renamed files in direct mode,
|
||||||
avoiding re-checksumming.
|
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
|
-- Joey Hess <joeyh@debian.org> Wed, 27 Feb 2013 23:20:40 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue