summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-06 16:56:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-06 16:56:55 -0400
commit17795032db18efd9ca7234d8adbef1c524f89f34 (patch)
treeaca729c892382f1fb23706ed4cfe22230d50d7bc
parentf8657604dcb4e265637cfce3481adb9518d1a049 (diff)
optimize pre-commit in direct mode
-rw-r--r--Command/PreCommit.hs6
-rw-r--r--Seek.hs4
2 files changed, 5 insertions, 5 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index 0418229b1..e675483c4 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -11,7 +11,6 @@ import Common.Annex
import Command
import qualified Command.Add
import qualified Command.Fix
-import Config
def :: [Command]
def = [command "pre-commit" paramPaths seek "run by git pre-commit hook"]
@@ -20,12 +19,9 @@ def = [command "pre-commit" paramPaths seek "run by git pre-commit hook"]
- And, it needs to inject unlocked files into the annex. -}
seek :: [CommandSeek]
seek =
- [ withFilesToBeCommitted $ whenNotDirect $ whenAnnexed $ Command.Fix.start
+ [ whenNotDirect $ withFilesToBeCommitted $ whenAnnexed $ Command.Fix.start
, withFilesUnlockedToBeCommitted start]
-whenNotDirect :: (FilePath -> Annex (Maybe CommandPerform)) -> FilePath -> Annex (Maybe CommandPerform)
-whenNotDirect a f = ifM isDirect ( stop , a f )
-
start :: FilePath -> CommandStart
start file = next $ perform file
diff --git a/Seek.hs b/Seek.hs
index 959255cbc..333afb6fc 100644
--- a/Seek.hs
+++ b/Seek.hs
@@ -20,6 +20,7 @@ import qualified Git.Command
import qualified Git.LsFiles as LsFiles
import qualified Limit
import qualified Option
+import Config
seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath]
seekHelper a params = do
@@ -123,3 +124,6 @@ prepFiltered a fs = do
notSymlink :: FilePath -> IO Bool
notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f
+
+whenNotDirect :: CommandSeek -> CommandSeek
+whenNotDirect a params = ifM isDirect ( return [] , a params )