summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-18 14:30:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-18 14:43:56 -0400
commitba27483c6a00ba36fd57150f338afc540d10b7f9 (patch)
tree5ad0e2dc5d6eb8980f507f9a62794714e40d62e7 /Assistant
parent9f05d19108f8a35c83c9a5075783b68f203e756f (diff)
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.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/Committer.hs9
1 files changed, 5 insertions, 4 deletions
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.