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=...
This commit is contained in:
Joey Hess 2011-09-18 20:41:51 -04:00
parent 9da23dff78
commit 33cd1ffbfe
5 changed files with 29 additions and 5 deletions

View file

@ -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