summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Seek.hs13
-rw-r--r--Utility/Path.hs11
-rw-r--r--debian/changelog4
-rw-r--r--doc/git-annex.mdwn3
4 files changed, 27 insertions, 4 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]
diff --git a/Utility/Path.hs b/Utility/Path.hs
index 38e7bd05c..9f4fe2927 100644
--- a/Utility/Path.hs
+++ b/Utility/Path.hs
@@ -134,3 +134,14 @@ inPath :: String -> IO Bool
inPath command = getSearchPath >>= anyM indir
where
indir d = doesFileExist $ d </> command
+
+{- Checks if a filename is a unix dotfile. All files inside dotdirs
+ - count as dotfiles. -}
+dotfile :: FilePath -> Bool
+dotfile file
+ | f == "." = False
+ | f == ".." = False
+ | f == "" = False
+ | otherwise = "." `isPrefixOf` f || dotfile (takeDirectory file)
+ where
+ f = takeFileName file
diff --git a/debian/changelog b/debian/changelog
index 33cced98e..c9619114e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,10 @@ git-annex (3.20111232) UNRELEASED; urgency=low
used to provide parameters to whichever of wget or curl git-annex uses
(depends on which is available, but most of their important options
suitable for use here are the same).
+ * 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.
-- Joey Hess <joeyh@debian.org> Mon, 02 Jan 2012 14:19:19 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index f94a3d808..9751560a9 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -64,7 +64,8 @@ subdirectories).
Adds files in the path to the annex. Files that are already checked into
git, or that git has been configured to ignore will be silently skipped.
- (Use --force to add ignored files.)
+ (Use --force to add ignored files.) Dotfiles are skipped unless explicitly
+ listed.
* get [path ...]