summaryrefslogtreecommitdiff
path: root/Command/PreCommit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-05 16:06:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-05 16:06:20 -0400
commit9c9d97b094b32e36dd0c7a86329adea830267453 (patch)
tree7dcd1564cd72a3806f5f989f855ca4d01e061b8a /Command/PreCommit.hs
parentb61c7206806d037de3e6c20beedebe5002c1a4aa (diff)
avoid pre-commit in direct mode
It was a no-op until my recent change that made lookupFile work in direct mode.
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r--Command/PreCommit.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index 06140fa52..0418229b1 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -11,6 +11,7 @@ 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"]
@@ -19,9 +20,12 @@ 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 $ whenAnnexed Command.Fix.start
+ [ withFilesToBeCommitted $ whenNotDirect $ 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