work around git check-ignore --batch bad exit status bug, and bring back import -J
authorJoey Hess <joeyh@joeyh.name>
Fri, 6 Nov 2015 19:39:51 +0000 (15:39 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 6 Nov 2015 19:39:51 +0000 (15:39 -0400)
Command/Import.hs
Git/CheckIgnore.hs
doc/git-annex-import.mdwn

index 14216ab734b15255778e489eb4b04cc7106b8ad8..0dbf2e44a541509e081eae76c6b65a3d82510c56 100644 (file)
@@ -21,7 +21,7 @@ import Annex.CheckIgnore
 import Annex.NumCopies
 
 cmd :: Command
-cmd = withGlobalOptions fileMatchingOptions $ notBareRepo $
+cmd = withGlobalOptions (jobsOption : fileMatchingOptions) $ notBareRepo $
        command "import" SectionCommon 
                "move and add files from outside git working copy"
                paramPaths (seek <$$> optParser)
@@ -59,7 +59,7 @@ duplicateModeParser =
                )
 
 seek :: ImportOptions -> CommandSeek
-seek o = do
+seek o = allowConcurrentOutput $ do
        repopath <- liftIO . absPath =<< fromRepo Git.repoPath
        inrepops <- liftIO $ filter (dirContains repopath) <$> mapM absPath (importFiles o)
        unless (null inrepops) $ do
index 322088f89dc726a335194d8f91801571cba3e069..7d30e5ada96c710ac22d3d0a77f8b99b3d9da0d3 100644 (file)
@@ -57,8 +57,10 @@ supportedGitVersion = do
        v <- Git.Version.installed
        return $ v >= Git.Version.normalize "1.8.4"
 
+{- For some reason, check-ignore --batch always exits nonzero, 
+ - so ignore any error. -}
 checkIgnoreStop :: CheckIgnoreHandle -> IO ()
-checkIgnoreStop = CoProcess.stop
+checkIgnoreStop = void . tryIO . CoProcess.stop
 
 {- Returns True if a file is ignored. -}
 checkIgnored :: CheckIgnoreHandle -> FilePath -> IO Bool
index 48c087aec285db6b7c9fc838654f55a2b2ce301f..ca37b81ebb81dfcfe9099a5dd7a87749a0ff965b 100644 (file)
@@ -66,6 +66,11 @@ Several options can be used to adjust handling of duplicate files.
 
                git annex import /dir --include='*.png'
 
+* `--jobs=N` `-JN`
+
+  Imports multiple files in parallel. This may be faster.
+  For example: `-J4`  
+
 # CAVEATS
 
 Note that using `--deduplicate` or `--clean-duplicates` with the WORM