summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-06 15:58:06 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-06 15:58:06 -0400
commit4c8cfa61bfb6fa1d9482a6b07b04d9ec11be4d0d (patch)
treefafe14b7fa3b445e9be5b87b0cbd005425f663be
parente462ad8071c58613e5cd2859ac982051091f8075 (diff)
import: Support file matching options such as --exclude, --include, --smallerthan, --largerthan
-rw-r--r--CmdLine/Seek.hs10
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn7
3 files changed, 16 insertions, 3 deletions
diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs
index 4a0bb299b..f3e37969a 100644
--- a/CmdLine/Seek.hs
+++ b/CmdLine/Seek.hs
@@ -66,14 +66,20 @@ withFilesInRefs a = mapM_ go
void $ commandAction $ a f k
withPathContents :: ((FilePath, FilePath) -> CommandStart) -> CommandSeek
-withPathContents a params = seekActions $
- map a . concat <$> liftIO (mapM get params)
+withPathContents a params = do
+ matcher <- Limit.getMatcher
+ seekActions $ map a <$> (filterM (checkmatch matcher) =<< ps)
where
+ ps = concat <$> liftIO (mapM get params)
get p = ifM (isDirectory <$> getFileStatus p)
( map (\f -> (f, makeRelative (parentDir p) f))
<$> dirContentsRecursiveSkipping (".git" `isSuffixOf`) True p
, return [(p, takeFileName p)]
)
+ checkmatch matcher (f, relf) = matcher $ MatchingFile $ FileInfo
+ { relFile = f
+ , matchFile = relf
+ }
withWords :: ([String] -> CommandStart) -> CommandSeek
withWords a params = seekActions $ return [a params]
diff --git a/debian/changelog b/debian/changelog
index 9ee48fb75..58c9519e2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ git-annex (5.20150206) UNRELEASED; urgency=medium
parameters it does not understand.
* groupwanted: New command to set the groupwanted preferred content
expression.
+ * import: Support file matching options such as --exclude, --include,
+ --smallerthan, --largerthan
-- Joey Hess <id@joeyh.name> Fri, 06 Feb 2015 13:57:08 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index ca987b4e2..d0064b20e 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -272,6 +272,11 @@ subdirectories).
(Note that using `--deduplicate` or `--clean-duplicates` with the WORM
backend does not look at file content, but filename and mtime.)
+
+ To control which files are imported, many of the MATCHING OPTIONS can
+ be used.
+
+ git annex import /dir --include='*.png'
* `importfeed [url ...]`
@@ -724,7 +729,7 @@ subdirectories).
When no item is specified, displays statistics and information
for the repository as a whole.
- When a directory is specified, the file matching options can be used
+ When a directory is specified, the MATCHING OPTIONS can be used
to select the files in the directory that are included in the statistics.
To only show the data that can be gathered quickly, use `--fast`.