import: Refuse to import files that are within the work tree, as that does not make sense and could cause data loss.
This commit is contained in:
parent
6ebf615995
commit
db5d831d07
3 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
7
debian/changelog
vendored
7
debian/changelog
vendored
|
@ -1,3 +1,10 @@
|
|||
git-annex (5.20150508.2) UNRELEASED; urgency=medium
|
||||
|
||||
* import: Refuse to import files that are within the work tree, as that
|
||||
does not make sense and could cause data loss.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 11 May 2015 12:45:06 -0400
|
||||
|
||||
git-annex (5.20150508.1) unstable; urgency=medium
|
||||
|
||||
* Now builds cleanly using ghc 7.10 (as well as ghc back to 7.6).
|
||||
|
|
|
@ -57,3 +57,6 @@ drwx------ 55 jkt jkt 8.0K May 8 13:54 ..
|
|||
drwxr-xr-x 8 jkt jkt 119 May 8 13:55 .git
|
||||
"""]]
|
||||
...and the file is gone :(.
|
||||
|
||||
> You should use `git annex add` in this case, not import.
|
||||
> I've made import refuse to run in this case. [[done]] --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue