From d50d89eb6fbe3698d105be2043043468dee9e386 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Sep 2012 12:58:53 -0400 Subject: support old versions of git that do not have --allow-empty-message --- Assistant/Threads/Committer.hs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 61e3a9287..946726c79 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -20,6 +20,7 @@ import qualified Annex import qualified Annex.Queue import qualified Git.Command import qualified Git.HashObject +import qualified Git.Version import Git.Types import qualified Command.Add import Utility.ThreadScheduler @@ -74,19 +75,23 @@ commitThread st changechan commitchan transferqueue dstatus = thread $ runEvery commitStaged :: Annex Bool commitStaged = do Annex.Queue.flush - void $ inRepo $ Git.Command.runBool "commit" - [ Param "--allow-empty-message" - , Param "-m", Param "" - -- 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. + void $ inRepo $ Git.Command.runBool "commit" $ nomessage + [ Param "--quiet" + {- 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 "--no-verify" - , 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 + where + nomessage ps + | Git.Version.older "1.7.2" = Param "-m" + : Param "autocommit" : ps + | otherwise = Param "--allow-empty-message" + : Param "-m" : Param "" : ps {- 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