assistant: Prevent automatic commits from causing git-gc runs, as that can make things quite slow. Instead, git-gc --auto is run once a day. (This can be disabled by the usual gc.auto=0 setting.)

This commit is contained in:
Joey Hess 2013-03-03 13:39:57 -04:00
parent 0c13d3065e
commit 6dea43831e
3 changed files with 12 additions and 1 deletions

View file

@ -82,7 +82,8 @@ commitStaged = do
Right _ -> do Right _ -> do
direct <- isDirect direct <- isDirect
let params = nomessage $ catMaybes let params = nomessage $ catMaybes
[ Just $ Param "commit" [ Just $ Param "-c", Just $ Param "gc.auto=0"
, Just $ Param "commit"
, Just $ Param "--quiet" , Just $ Param "--quiet"
{- In indirect mode, avoid running the {- In indirect mode, avoid running the
- usual git-annex pre-commit hook; - usual git-annex pre-commit hook;

View file

@ -14,6 +14,7 @@ import Assistant.Common
import Assistant.DaemonStatus import Assistant.DaemonStatus
import Assistant.Alert import Assistant.Alert
import qualified Git.LsFiles import qualified Git.LsFiles
import qualified Git.Command
import Utility.ThreadScheduler import Utility.ThreadScheduler
import qualified Assistant.Threads.Watcher as Watcher import qualified Assistant.Threads.Watcher as Watcher
import Utility.LogFile import Utility.LogFile
@ -71,6 +72,7 @@ waitForNextCheck = do
dailyCheck :: Assistant Bool dailyCheck :: Assistant Bool
dailyCheck = do dailyCheck = do
g <- liftAnnex gitRepo g <- liftAnnex gitRepo
-- Find old unstaged symlinks, and add them to git. -- Find old unstaged symlinks, and add them to git.
(unstaged, cleanup) <- liftIO $ Git.LsFiles.notInRepo False ["."] g (unstaged, cleanup) <- liftIO $ Git.LsFiles.notInRepo False ["."] g
now <- liftIO $ getPOSIXTime now <- liftIO $ getPOSIXTime
@ -81,6 +83,11 @@ dailyCheck = do
| isSymbolicLink s -> addsymlink file ms | isSymbolicLink s -> addsymlink file ms
_ -> noop _ -> noop
liftIO $ void cleanup liftIO $ void cleanup
{- Allow git-gc to run once per day. More frequent gc is avoided
- to avoid slowing things down. -}
void $ liftIO $ Git.Command.runBool [Param "gc", Param "--auto"] g
return True return True
where where
toonew timestamp now = now < (realToFrac (timestamp + slop) :: POSIXTime) toonew timestamp now = now < (realToFrac (timestamp + slop) :: POSIXTime)

3
debian/changelog vendored
View file

@ -9,6 +9,9 @@ git-annex (4.20130228) UNRELEASED; urgency=low
files in direct mode repositories. files in direct mode repositories.
* assistant: Fix dropping content when a file is moved to an archive * assistant: Fix dropping content when a file is moved to an archive
directory. directory.
* assistant: Prevent automatic commits from causing git-gc runs,
as that can make things quite slow. Instead, git-gc --auto is run
once a day. (This can be disabled by the usual gc.auto=0 setting.)
-- 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