aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-24 14:54:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-24 14:54:36 -0400
commit89ded71d9f0174878733bbca59b02c0f6c3c6ccc (patch)
tree30fce1de7a7e0527700d339fd485b91e694a41ed /Command.hs
parente8abfbba6c46f5a31139d0fb37b592d0db9c278c (diff)
add a guard against using git annex add in direct mode repo
Currently, it deletes files when run in one, so until I get a chance to fix it, block foot shooting.
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Command.hs b/Command.hs
index 478dfdc39..6c127c15d 100644
--- a/Command.hs
+++ b/Command.hs
@@ -18,6 +18,7 @@ module Command (
whenAnnexed,
ifAnnexed,
notBareRepo,
+ notDirect,
isBareRepo,
numCopies,
numCopiesCheck,
@@ -103,6 +104,12 @@ notBareRepo a = do
error "You cannot run this subcommand in a bare repository."
a
+notDirect :: Annex a -> Annex a
+notDirect a = ifM isDirect
+ ( error "You cannot run this subcommand in a direct mode repository."
+ , a
+ )
+
isBareRepo :: Annex Bool
isBareRepo = fromRepo Git.repoIsLocalBare