summaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-29 16:17:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-29 16:17:13 -0400
commit1e5aca5087e573aa93b4b6efe7c6f5abd90d0001 (patch)
treee54552bdc584b338d58003eb6015074cf89465c6 /Command/Add.hs
parent7d7b03e9ceab25efad67fc99e5b0813d210b1381 (diff)
New annex.largefiles setting, which configures which files `git annex add` and the assistant add to the annex.
I would have sort of liked to put this in .gitattributes, but it seems it does not support multi-word attribute values. Also, making this a single config setting makes it easy to only parse the expression once. A natural next step would be to make the assistant `git add` files that are not annex.largefiles. OTOH, I don't think `git annex add` should `git add` such files, because git-annex command line tools are not in the business of wrapping git command line tools.
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index cf2a55c50..83b1ca22c 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -1,6 +1,6 @@
{- git-annex command
-
- - Copyright 2010 Joey Hess <joey@kitenet.net>
+ - Copyright 2010, 2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -27,6 +27,7 @@ import Utility.Touch
import Utility.FileMode
import Config
import Utility.InodeCache
+import Annex.FileMatcher
def :: [Command]
def = [notBareRepo $ command "add" paramPaths seek SectionCommon
@@ -37,10 +38,16 @@ def = [notBareRepo $ command "add" paramPaths seek SectionCommon
- In direct mode, it acts on any files that have changed. -}
seek :: [CommandSeek]
seek =
- [ withFilesNotInGit start
- , whenNotDirect $ withFilesUnlocked start
- , whenDirect $ withFilesMaybeModified start
+ [ go withFilesNotInGit
+ , whenNotDirect $ go withFilesUnlocked
+ , whenDirect $ go withFilesMaybeModified
]
+ where
+ go a = withValue largeFilesMatcher $ \matcher ->
+ a $ \file -> ifM (checkFileMatcher matcher file)
+ ( start file
+ , stop
+ )
{- 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