summaryrefslogtreecommitdiff
path: root/Seek.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-03 00:09:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-03 00:11:00 -0400
commit34abd7bca80a8cc012f92d64116014449b1b2392 (patch)
tree6e0213466cc730b337f619b9df94d771b0c5fc88 /Seek.hs
parentab8fa0d2056e55af829bdf843e162e97ac903f4d (diff)
no implicit dotfiles in add
Dotfiles, and files inside dotdirs are not added by "git annex add" unless the dotfile or directory is explicitly listed. So "git annex add ." will add all untracked files in the current directory except for those in dotdirs. One reason for this is that it will make git-annex more usable with vcsh, where you don't want "vcsh big annex add" to check in all the dotfiles that are already versioned in other repositories. (If you're using vcsh for repos that contain non-dotfiles, this won't help, and you'll need to .gitignore such things, but this will cover the common case.) A more general reason why this seems like a good idea is the same reason ls ignores dotfiles, just the unix convention that they are cruft that is kept out of the way most of the time. All the other git-annex commands still do deal with any dotfiles that do get into the annex. This seemed right because if I've gone to the trouble to add a dotfile, I will want "git annex get ." to get it along with everything else.
Diffstat (limited to 'Seek.hs')
-rw-r--r--Seek.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Seek.hs b/Seek.hs
index 251db50b8..80f31dd96 100644
--- a/Seek.hs
+++ b/Seek.hs
@@ -46,9 +46,16 @@ withBackendFilesInGit a params = do
withFilesNotInGit :: (BackendFile -> CommandStart) -> CommandSeek
withFilesNotInGit a params = do
- force <- Annex.getState Annex.force
- newfiles <- seekHelper (LsFiles.notInRepo force) params
- prepBackendPairs a newfiles
+ {- dotfiles are not acted on unless explicitly listed -}
+ files <- filter (not . dotfile) <$> seek ps
+ dotfiles <- if null dotps then return [] else seek dotps
+ prepBackendPairs a $ preserveOrder params (files++dotfiles)
+ where
+ (dotps, ps) = partition dotfile params
+ seek l = do
+ force <- Annex.getState Annex.force
+ g <- gitRepo
+ liftIO $ (\p -> LsFiles.notInRepo force p g) l
withWords :: ([String] -> CommandStart) -> CommandSeek
withWords a params = return [a params]