2012-02-25 20:31:38 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
2012-02-25 20:31:38 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2012-02-25 20:31:38 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Commit where
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import qualified Annex.Branch
|
2012-03-14 16:01:56 +00:00
|
|
|
import qualified Git
|
2020-09-15 19:44:37 +00:00
|
|
|
import Git.Types
|
2012-02-25 20:31:38 +00:00
|
|
|
|
2015-07-08 16:33:27 +00:00
|
|
|
cmd :: Command
|
2015-07-08 19:08:02 +00:00
|
|
|
cmd = command "commit" SectionPlumbing
|
|
|
|
"commits any staged changes to the git-annex branch"
|
|
|
|
paramNothing (withParams seek)
|
2012-02-25 20:31:38 +00:00
|
|
|
|
2015-07-08 16:33:27 +00:00
|
|
|
seek :: CmdParams -> CommandSeek
|
2018-10-01 18:12:06 +00:00
|
|
|
seek = withNothing (commandAction start)
|
2012-02-25 20:31:38 +00:00
|
|
|
|
|
|
|
start :: CommandStart
|
2020-09-15 19:44:37 +00:00
|
|
|
start = starting "commit" ai si $ do
|
|
|
|
Annex.Branch.commit =<< Annex.Branch.commitMessage
|
|
|
|
_ <- runhook <=< inRepo $ Git.hookPath "annex-content"
|
|
|
|
next $ return True
|
2012-11-12 05:05:04 +00:00
|
|
|
where
|
|
|
|
runhook (Just hook) = liftIO $ boolSystem hook []
|
|
|
|
runhook Nothing = return True
|
2020-09-15 19:44:37 +00:00
|
|
|
ai = ActionItemOther (Just (fromRef Annex.Branch.name))
|
|
|
|
si = SeekInput []
|