better prevention of auto repack

Looking through the git sources (documentation is unclear),
it seems commit doesn't ever trigger git-gc, mostly fetching and merging
seems to. I cannot easily override the setting in all those places, so
instead set gc.auto in git config when initializing a repository with
the assistant.

This does mean that the user cannot set gc.auto=0 and completely avoid
repacks, as the assistant does it daily. But, it only does it after there
are 100x the default number of loose objects, so this is probably not going
to be too annoying.
This commit is contained in:
Joey Hess 2013-03-03 14:07:13 -04:00
parent cd06ede772
commit 789ca15012
4 changed files with 26 additions and 10 deletions

View file

@ -302,9 +302,9 @@ initRepo primary_assistant_repo dir desc = inDir dir $ do
{- Initialize a git-annex repository in a directory with a description. -}
unlessM isInitialized $
initialize desc
{- Initialize the master branch, so things that expect
- to have it will work, before any files are added. -}
unlessM (Git.Config.isBare <$> gitRepo) $
{- Initialize the master branch, so things that expect
- to have it will work, before any files are added. -}
void $ inRepo $ Git.Command.runBool
[ Param "commit"
, Param "--quiet"
@ -312,8 +312,15 @@ initRepo primary_assistant_repo dir desc = inDir dir $ do
, Param "-m"
, Param "created repository"
]
when primary_assistant_repo $
{- Repositories directly managed by the assistant use direct mode.
-
- Automatic gc is disabled, as it can be slow. Insted, gc is done
- once a day.
-}
when primary_assistant_repo $ do
setDirect True
inRepo $ Git.Command.run
[Param "config", Param "gc.auto", Param "0"]
getUUID
{- Adds a directory to the autostart file. -}