From ba27483c6a00ba36fd57150f338afc540d10b7f9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Sep 2012 14:30:35 -0400 Subject: avoid making empty commits This doesn't avoid it sometimes attempting to commit when there are no changes. Typically that happens when a change is pushed in from another repo; the watcher sees the file and tries to stage it, resulting in an empty commit. Really fixing that would probably use more CPU than occasionally trying to make an empty commit. However, this does save a lot of unnecessary work, as those empty commits had to be synced out, which no longer happens. --- Assistant/Threads/Committer.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Assistant') diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 809245325..eb09be680 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -74,17 +74,18 @@ commitThread st changechan commitchan transferqueue dstatus = thread $ runEvery commitStaged :: Annex Bool commitStaged = do Annex.Queue.flush - inRepo $ Git.Command.runBool "commit" + void $ inRepo $ Git.Command.runBool "commit" [ Param "--allow-empty-message" , Param "-m", Param "" - -- Empty commits may be made if tree changes cancel - -- each other out, etc - , Param "--allow-empty" -- Avoid running the usual git-annex pre-commit hook; -- watch does the same symlink fixing, and we don't want -- to deal with unlocked files in these commits. , Param "--quiet" ] + {- Empty commits may be made if tree changes cancel + - each other out, etc. Git returns nonzero on those, so + - don't propigate out commit failures. -} + return True {- Decide if now is a good time to make a commit. - Note that the list of change times has an undefined order. -- cgit v1.2.3