diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-04-08 16:14:23 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-04-08 16:14:23 -0400 |
commit | 723246afab6fb3a9f2b4a0847111c2ed3f586fd2 (patch) | |
tree | c4e2c8b48a66add512b3b71954c5dc16fcc0bfa5 /Command | |
parent | d8394ede7b16d9aafcc19885f31d7935250a9bb6 (diff) |
add: If annex.largefiles is set and does not match a file that's being added, the file will be checked into git rather than being added to the annex. Previously, git annex add skipped over such files; this new behavior is more useful in direct mode.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 7faa7c80d..eb0dc22d8 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -52,7 +52,7 @@ seek ps = do matcher <- largeFilesMatcher let go a = flip a ps $ \file -> ifM (checkFileMatcher matcher file <||> Annex.getState Annex.force) ( start file - , stop + , startSmall file ) skipdotfiles <- not <$> Annex.getFlag (optionName includeDotFilesOption) go $ withFilesNotInGit skipdotfiles @@ -61,6 +61,16 @@ seek ps = do , go withFilesUnlocked ) +{- Pass file off to git-add. -} +startSmall :: FilePath -> CommandStart +startSmall file = do + showStart "add" file + showNote "non-large file; adding to git directly" + next $ do + params <- forceParams + Annex.Queue.addCommand "add" (params++[Param "--"]) [file] + next $ return True + {- The add subcommand annexes a file, generating a key for it using a - backend, and then moving it into the annex directory and setting up - the symlink pointing to its content. -} @@ -260,16 +270,19 @@ addLink :: FilePath -> Key -> Maybe InodeCache -> Annex () addLink file key mcache = ifM (coreSymlinks <$> Annex.getGitConfig) ( do _ <- link file key mcache - params <- ifM (Annex.getState Annex.force) - ( return [Param "-f"] - , return [] - ) + params <- forceParams Annex.Queue.addCommand "add" (params++[Param "--"]) [file] , do l <- link file key mcache addAnnexLink l file ) +forceParams :: Annex [CommandParam] +forceParams = ifM (Annex.getState Annex.force) + ( return [Param "-f"] + , return [] + ) + cleanup :: FilePath -> Key -> Maybe InodeCache -> Bool -> CommandCleanup cleanup file key mcache hascontent = do ifM (isDirect <&&> pure hascontent) |