diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-25 17:54:08 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-25 17:54:08 -0400 |
commit | a9c5a30db304e9d84c4d3c17d075f16db69cd278 (patch) | |
tree | a6ffc8d972730ef4ad78d40ae0299f0d440d821e /Seek.hs | |
parent | 8a1831845f48062745f9b901c0bb9d060450c564 (diff) |
Display a warning when a non-existing file or directory is specified.
Diffstat (limited to 'Seek.hs')
-rw-r--r-- | Seek.hs | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -22,8 +22,14 @@ import qualified Limit import qualified Option seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath] -seekHelper a params = inRepo $ \g -> - runPreserveOrder (\fs -> Git.Command.leaveZombie <$> a fs g) params +seekHelper a params = do + ll <- inRepo $ \g -> + runSegmentPaths (\fs -> Git.Command.leaveZombie <$> a fs g) params + {- Show warnings only for files/directories that do not exist. -} + forM_ (map fst $ filter (null . snd) $ zip params ll) $ \p -> + unlessM (liftIO $ doesFileExist p <||> doesDirectoryExist p) $ + fileNotFound p + return $ concat ll withFilesInGit :: (FilePath -> CommandStart) -> CommandSeek withFilesInGit a params = prepFiltered a $ seekHelper LsFiles.inRepo params @@ -34,7 +40,7 @@ withFilesNotInGit a params = do files <- filter (not . dotfile) <$> seekunless (null ps && not (null params)) ps dotfiles <- seekunless (null dotps) dotps - prepFiltered a $ return $ preserveOrder params (files++dotfiles) + prepFiltered a $ return $ concat $ segmentPaths params (files++dotfiles) where (dotps, ps) = partition dotfile params seekunless True _ = return [] |