support old versions of git that do not have --allow-empty-message

This commit is contained in:
Joey Hess 2012-09-19 12:58:53 -04:00
parent c4e8591351
commit d50d89eb6f

View file

@ -20,6 +20,7 @@ import qualified Annex
import qualified Annex.Queue import qualified Annex.Queue
import qualified Git.Command import qualified Git.Command
import qualified Git.HashObject import qualified Git.HashObject
import qualified Git.Version
import Git.Types import Git.Types
import qualified Command.Add import qualified Command.Add
import Utility.ThreadScheduler import Utility.ThreadScheduler
@ -74,19 +75,23 @@ commitThread st changechan commitchan transferqueue dstatus = thread $ runEvery
commitStaged :: Annex Bool commitStaged :: Annex Bool
commitStaged = do commitStaged = do
Annex.Queue.flush Annex.Queue.flush
void $ inRepo $ Git.Command.runBool "commit" void $ inRepo $ Git.Command.runBool "commit" $ nomessage
[ Param "--allow-empty-message" [ Param "--quiet"
, Param "-m", Param "" {- Avoid running the usual git-annex pre-commit hook;
-- Avoid running the usual git-annex pre-commit hook; - watch does the same symlink fixing, and we don't want
-- watch does the same symlink fixing, and we don't want - to deal with unlocked files in these commits. -}
-- to deal with unlocked files in these commits.
, Param "--no-verify" , Param "--no-verify"
, Param "--quiet"
] ]
{- Empty commits may be made if tree changes cancel {- Empty commits may be made if tree changes cancel
- each other out, etc. Git returns nonzero on those, so - each other out, etc. Git returns nonzero on those, so
- don't propigate out commit failures. -} - don't propigate out commit failures. -}
return True 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. {- Decide if now is a good time to make a commit.
- Note that the list of change times has an undefined order. - Note that the list of change times has an undefined order.