summaryrefslogtreecommitdiff
path: root/Command/PreCommit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-28 14:19:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-28 14:21:30 -0400
commit92e5d28ca83d057a3d8f5d7d30806642de699172 (patch)
treea4021ec369a077dd3916c98e3ebfd9e368302afc /Command/PreCommit.hs
parent1f9ce9e9a5f6d7eaf149f42de559cb9830c7f28e (diff)
precommit: Optimise to avoid calling git-check-attr more than once.
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r--Command/PreCommit.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index d4e5c04b9..513d5d43f 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -11,7 +11,6 @@ import Control.Monad.State (liftIO)
import Command
import qualified Annex
-import qualified Backend
import qualified GitRepo as Git
import qualified Command.Add
import qualified Command.Fix
@@ -20,15 +19,14 @@ import qualified Command.Fix
- And, it needs to inject unlocked files into the annex. -}
seek :: [SubCmdSeek]
seek = [withFilesToBeCommitted Command.Fix.start,
- withUnlockedFilesToBeCommitted start]
+ withFilesUnlockedToBeCommitted start]
-start :: SubCmdStartString
-start file = return $ Just $ perform file
+start :: SubCmdStartBackendFile
+start pair = return $ Just $ perform pair
-perform :: FilePath -> SubCmdPerform
-perform file = do
- pairs <- Backend.chooseBackends [file]
- ok <- doSubCmd $ Command.Add.start $ head pairs
+perform :: BackendFile -> SubCmdPerform
+perform pair@(file, _) = do
+ ok <- doSubCmd $ Command.Add.start pair
if ok
then return $ Just $ cleanup file
else error $ "failed to add " ++ file ++ "; canceling commit"