diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-26 14:52:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-26 14:52:07 -0400 |
commit | 0937413b678c9c4d04d0d69bf9ba673a8a0f7ab3 (patch) | |
tree | d2660d274d534a0ca9eacf5d9b905527b86b0e4e /CmdLine | |
parent | 19bf29a0bce26eb60dcf2480967e0a3088afac67 (diff) |
add --include-dotfiles: New option, perhaps useful for backups.
Diffstat (limited to 'CmdLine')
-rw-r--r-- | CmdLine/Seek.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs index e95b9f005..abbe52af8 100644 --- a/CmdLine/Seek.hs +++ b/CmdLine/Seek.hs @@ -30,14 +30,15 @@ withFilesInGit :: (FilePath -> CommandStart) -> CommandSeek withFilesInGit a params = seekActions $ prepFiltered a $ seekHelper LsFiles.inRepo params -withFilesNotInGit :: (FilePath -> CommandStart) -> CommandSeek -withFilesNotInGit a params = do - {- dotfiles are not acted on unless explicitly listed -} - files <- filter (not . dotfile) <$> - seekunless (null ps && not (null params)) ps - dotfiles <- seekunless (null dotps) dotps - seekActions $ prepFiltered a $ - return $ concat $ segmentPaths params (files++dotfiles) +withFilesNotInGit :: Bool -> (FilePath -> CommandStart) -> CommandSeek +withFilesNotInGit skipdotfiles a params + | skipdotfiles = do + {- dotfiles are not acted on unless explicitly listed -} + files <- filter (not . dotfile) <$> + seekunless (null ps && not (null params)) ps + dotfiles <- seekunless (null dotps) dotps + go (files++dotfiles) + | otherwise = go =<< seekunless False params where (dotps, ps) = partition dotfile params seekunless True _ = return [] @@ -45,6 +46,8 @@ withFilesNotInGit a params = do force <- Annex.getState Annex.force g <- gitRepo liftIO $ Git.Command.leaveZombie <$> LsFiles.notInRepo force l g + go l = seekActions $ prepFiltered a $ + return $ concat $ segmentPaths params l withPathContents :: ((FilePath, FilePath) -> CommandStart) -> CommandSeek withPathContents a params = seekActions $ |