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 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.