summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-02 14:48:42 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-02 14:49:03 -0400
commit8e7728b312704f6f4cb84d81302c1518f0e85948 (patch)
treec547f1be8464b98e18087d45188a9fbbb2dd3dfb
parent31d4313d575a566a695d93e3e7ee34bddd41d705 (diff)
import: Changed to honor annex.largefiles settings.
-rw-r--r--Command/Add.hs6
-rw-r--r--Command/Import.hs14
-rw-r--r--debian/changelog1
-rw-r--r--doc/git-annex.mdwn2
4 files changed, 17 insertions, 6 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index fd92f04ef..4ae97b6e3 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -73,8 +73,12 @@ seek o = allowConcurrentOutput $ do
startSmall :: FilePath -> CommandStart
startSmall file = do
showStart "add" file
+ next $ performSmall file
+
+performSmall :: FilePath -> CommandPerform
+performSmall file = do
showNote "non-large file; adding content to git repository"
- next $ performAdd file
+ performAdd file
performAdd :: FilePath -> CommandPerform
performAdd file = do
diff --git a/Command/Import.hs b/Command/Import.hs
index 0dbf2e44a..3887ea57b 100644
--- a/Command/Import.hs
+++ b/Command/Import.hs
@@ -19,6 +19,8 @@ import Types.KeySource
import Types.Key
import Annex.CheckIgnore
import Annex.NumCopies
+import Types.FileMatcher
+import Annex.FileMatcher
cmd :: Command
cmd = withGlobalOptions (jobsOption : fileMatchingOptions) $ notBareRepo $
@@ -64,10 +66,11 @@ seek o = allowConcurrentOutput $ do
inrepops <- liftIO $ filter (dirContains repopath) <$> mapM absPath (importFiles o)
unless (null inrepops) $ do
error $ "cannot import files from inside the working tree (use git annex add instead): " ++ unwords inrepops
- withPathContents (start (duplicateMode o)) (importFiles o)
+ largematcher <- largeFilesMatcher
+ withPathContents (start largematcher (duplicateMode o)) (importFiles o)
-start :: DuplicateMode -> (FilePath, FilePath) -> CommandStart
-start mode (srcfile, destfile) =
+start :: FileMatcher Annex -> DuplicateMode -> (FilePath, FilePath) -> CommandStart
+start largematcher mode (srcfile, destfile) =
ifM (liftIO $ isRegularFile <$> getSymbolicLinkStatus srcfile)
( do
ma <- pickaction
@@ -124,7 +127,10 @@ start mode (srcfile, destfile) =
liftIO $ if mode == Duplicate || mode == SkipDuplicates
then void $ copyFileExternal CopyAllMetaData srcfile destfile
else moveFile srcfile destfile
- Command.Add.perform destfile
+ ifM (checkFileMatcher largematcher destfile)
+ ( Command.Add.perform destfile
+ , Command.Add.performSmall destfile
+ )
notoverwriting why = do
warning $ "not overwriting existing " ++ destfile ++ " " ++ why
stop
diff --git a/debian/changelog b/debian/changelog
index 282e54710..144e2c907 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ git-annex (5.20151117) UNRELEASED; urgency=medium
444, since that prevents a user other than the file owner from locking
them. Instead, a mode such as 664 is used in this case.
* tahoe: Include tahoe capabilities in whereis display.
+ * import: Changed to honor annex.largefiles settings.
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2015 16:49:34 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 8a624b507..e41f9d655 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -801,7 +801,7 @@ Here are all the supported configuration settings.
annex.largefiles = largerthan=100kb and not (include=*.c or include=*.h)
- This setting is used by `git annex add` and the assistant.
+ This setting is used by `git annex add`, `git annex import` and the assistant.
It can be useful to temporarily override it via -c at the command line.
For example: