summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Import.hs15
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/git_annex_import:_ignored_names_fatal.mdwn3
3 files changed, 15 insertions, 5 deletions
diff --git a/Command/Import.hs b/Command/Import.hs
index 17cb49db1..060be6c65 100644
--- a/Command/Import.hs
+++ b/Command/Import.hs
@@ -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,11 +80,15 @@ start mode (srcfile, destfile) =
next $ return True
importfile = do
handleexisting =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus destfile)
- liftIO $ createDirectoryIfMissing True (parentDir destfile)
- liftIO $ if mode == Duplicate || mode == SkipDuplicates
- then void $ copyFileExternal CopyAllMetaData srcfile destfile
- else moveFile srcfile destfile
- Command.Add.perform 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
+ else moveFile srcfile destfile
+ Command.Add.perform destfile
handleexisting Nothing = noop
handleexisting (Just s)
| isDirectory s = notoverwriting "(is a directory)"
diff --git a/debian/changelog b/debian/changelog
index 4840490d4..527a09f41 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/bugs/git_annex_import:_ignored_names_fatal.mdwn b/doc/bugs/git_annex_import:_ignored_names_fatal.mdwn
index e96ca2acb..8981cadd8 100644
--- a/doc/bugs/git_annex_import:_ignored_names_fatal.mdwn
+++ b/doc/bugs/git_annex_import:_ignored_names_fatal.mdwn
@@ -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]]