summaryrefslogtreecommitdiff
path: root/Command/Import.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Import.hs')
-rw-r--r--Command/Import.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Command/Import.hs b/Command/Import.hs
index eb21faea2..fffa301ec 100644
--- a/Command/Import.hs
+++ b/Command/Import.hs
@@ -9,6 +9,7 @@ module Command.Import where
import Common.Annex
import Command
+import qualified Git
import qualified Annex
import qualified Command.Add
import Utility.CopyFile
@@ -62,6 +63,10 @@ getDuplicateMode = go . catMaybes <$> mapM getflag [minBound..maxBound]
seek :: CommandSeek
seek ps = do
mode <- getDuplicateMode
+ repopath <- liftIO . absPath =<< fromRepo Git.repoPath
+ inrepops <- liftIO $ filter (dirContains repopath) <$> mapM absPath ps
+ unless (null inrepops) $ do
+ error $ "cannot import files from inside the working tree (use git annex add instead): " ++ unwords inrepops
withPathContents (start mode) ps
start :: DuplicateMode -> (FilePath, FilePath) -> CommandStart