import: Changed to honor annex.largefiles settings.
authorJoey Hess <joeyh@joeyh.name>
Wed, 2 Dec 2015 18:48:42 +0000 (14:48 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 2 Dec 2015 18:49:03 +0000 (14:49 -0400)
Command/Add.hs
Command/Import.hs
debian/changelog
doc/git-annex.mdwn

index fd92f04ef93569bb5bf7d9adb5d0a46c245bc45a..4ae97b6e38fb0b91072f4123e89ce8764b6f5a11 100644 (file)
@@ -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
index 0dbf2e44a541509e081eae76c6b65a3d82510c56..3887ea57b5db9c8cc71d89a4b8910d3cca0cea6f 100644 (file)
@@ -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
index 282e54710e0e2e335573d60bd34e457e90a09372..144e2c907cbdd38e92d5299493a46dd08ef87830 100644 (file)
@@ -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
 
index 8a624b507de01a89cb88401268d860dc35df136c..e41f9d65541595de9e96d2617be444137e0f4be2 100644 (file)
@@ -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: