summaryrefslogtreecommitdiff
path: root/Checks.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Checks.hs')
-rw-r--r--Checks.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Checks.hs b/Checks.hs
index 94ee75291..3757abb27 100644
--- a/Checks.hs
+++ b/Checks.hs
@@ -13,6 +13,7 @@ module Checks where
import Common.Annex
import Types.Command
import Init
+import Config
commonChecks :: [CommandCheck]
commonChecks = [repoExists]
@@ -20,6 +21,10 @@ commonChecks = [repoExists]
repoExists :: CommandCheck
repoExists = CommandCheck 0 ensureInitialized
+notDirect :: Command -> Command
+notDirect = addCheck $ whenM isDirect $
+ error "You cannot run this subcommand in a direct mode repository."
+
dontCheck :: CommandCheck -> Command -> Command
dontCheck check cmd = mutateCheck cmd $ \c -> filter (/= check) c
@@ -29,3 +34,4 @@ addCheck check cmd = mutateCheck cmd $ \c ->
mutateCheck :: Command -> ([CommandCheck] -> [CommandCheck]) -> Command
mutateCheck cmd@(Command { cmdcheck = c }) a = cmd { cmdcheck = a c }
+