summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command.hs7
-rw-r--r--Command/Add.hs2
2 files changed, 8 insertions, 1 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
diff --git a/Command/Add.hs b/Command/Add.hs
index e589d058d..e18f8592c 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -33,7 +33,7 @@ seek = [withFilesNotInGit start, withFilesUnlocked start]
- backend, and then moving it into the annex directory and setting up
- the symlink pointing to its content. -}
start :: FilePath -> CommandStart
-start file = notBareRepo $ ifAnnexed file fixup add
+start file = notBareRepo $ notDirect $ ifAnnexed file fixup add
where
add = do
s <- liftIO $ getSymbolicLinkStatus file