import: Check for gitignored files before moving them into the tree. (Needs git 1.8.4 or newer.)

This commit is contained in:
Joey Hess 2015-04-29 13:46:12 -04:00
parent d8ffa498ef
commit 2e54251c18
3 changed files with 15 additions and 5 deletions

View file

@ -16,6 +16,7 @@ import Backend
import Remote
import Types.KeySource
import Types.Key
import Annex.CheckIgnore
cmd :: [Command]
cmd = [withOptions opts $ notBareRepo $ command "import" paramPaths seek
@ -79,6 +80,10 @@ start mode (srcfile, destfile) =
next $ return True
importfile = do
handleexisting =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus destfile)
ignored <- not <$> Annex.getState Annex.force <&&> checkIgnored destfile
if ignored
then error $ "not importing " ++ destfile ++ " which is .gitignored (use --force to override)"
else do
liftIO $ createDirectoryIfMissing True (parentDir destfile)
liftIO $ if mode == Duplicate || mode == SkipDuplicates
then void $ copyFileExternal CopyAllMetaData srcfile destfile

2
debian/changelog vendored
View file

@ -11,6 +11,8 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
* S3: Fix incompatability with bucket names used by hS3; the aws library
cannot handle upper-case bucket names. git-annex now converts them to
lower case automatically.
* import: Check for gitignored files before moving them into the tree.
(Needs git 1.8.4 or newer.)
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400

View file

@ -36,3 +36,6 @@ Can't the ignored files just be ignored?
# End of transcript or log.
"""]]
> Made git-annex import check for gitignored files before
> moving them into the work tree. [[done]] --[[Joey]]