summaryrefslogtreecommitdiff
path: root/Command/Find.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-18 20:41:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-18 20:42:15 -0400
commit33cd1ffbfe200188a4fc61fd5715e7aa29556d7f (patch)
treeb21be384c89e29e2b56e5e1c5e1a931871837c27 /Command/Find.hs
parent9da23dff78d80158ba01a271ac2a32830fd9bccc (diff)
make find show files meeting limits, even when not present
find: Rather than only showing files whose contents are present, when used with --exclude --copies or --in, displays all files that match the specified conditions. Note that this is a behavior change for find --exclude! Old behavior can be gotten with find --in . --exclude=...
Diffstat (limited to 'Command/Find.hs')
-rw-r--r--Command/Find.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Command/Find.hs b/Command/Find.hs
index 51849f6b8..effb33184 100644
--- a/Command/Find.hs
+++ b/Command/Find.hs
@@ -7,11 +7,12 @@
module Command.Find where
-import Control.Monad.State (liftIO)
+import Control.Monad.State
import Command
import Content
import Utility.Conditional
+import Limit
command :: [Command]
command = [repoCommand "find" paramPaths seek "lists available files"]
@@ -19,8 +20,10 @@ command = [repoCommand "find" paramPaths seek "lists available files"]
seek :: [CommandSeek]
seek = [withFilesInGit start]
-{- Output a list of files. -}
start :: FilePath -> CommandStart
start file = isAnnexed file $ \(key, _) -> do
- whenM (inAnnex key) $ liftIO $ putStrLn file
+ -- only files inAnnex are shown, unless the user has requested
+ -- others via a limit
+ whenM (liftM2 (||) (inAnnex key) limited) $
+ liftIO $ putStrLn file
stop