summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assistant/Threads/SanityChecker.hs2
-rw-r--r--Seek.hs3
-rw-r--r--Utility/Directory.hs3
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/git_annex_import_destroys_a_fellow_git_annex_repository.mdwn4
5 files changed, 10 insertions, 3 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs
index 7d6057924..b3aa9ddfd 100644
--- a/Assistant/Threads/SanityChecker.hs
+++ b/Assistant/Threads/SanityChecker.hs
@@ -162,7 +162,7 @@ checkStaleGitLocks :: Assistant ()
checkStaleGitLocks = do
lockfiles <- filter (not . isInfixOf "gc.pid")
. filter (".lock" `isSuffixOf`)
- <$> (liftIO . dirContentsRecursiveSkipping (annexDir `isInfixOf`)
+ <$> (liftIO . dirContentsRecursiveSkipping (== dropTrailingPathSeparator annexDir)
=<< liftAnnex (fromRepo Git.localGitDir))
checkStaleLocks lockfiles
checkStaleLocks :: [FilePath] -> Assistant ()
diff --git a/Seek.hs b/Seek.hs
index 85b266d49..d140e09e8 100644
--- a/Seek.hs
+++ b/Seek.hs
@@ -60,7 +60,8 @@ withPathContents :: ((FilePath, FilePath) -> CommandStart) -> CommandSeek
withPathContents a params = map a . concat <$> liftIO (mapM get params)
where
get p = ifM (isDirectory <$> getFileStatus p)
- ( map (\f -> (f, makeRelative (parentDir p) f)) <$> dirContentsRecursive p
+ ( map (\f -> (f, makeRelative (parentDir p) f))
+ <$> dirContentsRecursiveSkipping (".git" `isSuffixOf`) p
, return [(p, takeFileName p)]
)
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index 42de1e8dd..4918d20be 100644
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -40,12 +40,13 @@ dirContents d = map (d </>) . filter (not . dirCruft) <$> getDirectoryContents d
dirContentsRecursive :: FilePath -> IO [FilePath]
dirContentsRecursive topdir = dirContentsRecursiveSkipping (const False) topdir
+{- Skips directories whose basenames match the skipdir. -}
dirContentsRecursiveSkipping :: (FilePath -> Bool) -> FilePath -> IO [FilePath]
dirContentsRecursiveSkipping skipdir topdir = go [topdir]
where
go [] = return []
go (dir:dirs)
- | skipdir dir = go dirs
+ | skipdir (takeFileName dir) = go dirs
| otherwise = unsafeInterleaveIO $ do
(files, dirs') <- collect [] []
=<< catchDefaultIO [] (dirContents dir)
diff --git a/debian/changelog b/debian/changelog
index 166ff0121..8742d248f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ git-annex (4.20131003) UNRELEASED; urgency=low
shorter than the maximum unix domain socket length, because ssh
appends stuff to it to make a temporary filename. Closes: #725512
* status: Fix space leak in local mode, introduced in version 4.20130920.
+ * import: Skip .git directories.
-- Joey Hess <joeyh@debian.org> Thu, 03 Oct 2013 15:41:24 -0400
diff --git a/doc/bugs/git_annex_import_destroys_a_fellow_git_annex_repository.mdwn b/doc/bugs/git_annex_import_destroys_a_fellow_git_annex_repository.mdwn
index ffc4bcc1d..c8307ca6b 100644
--- a/doc/bugs/git_annex_import_destroys_a_fellow_git_annex_repository.mdwn
+++ b/doc/bugs/git_annex_import_destroys_a_fellow_git_annex_repository.mdwn
@@ -124,3 +124,7 @@ anarcat@angela:foo$
"""]]
Thanks! --[[anarcat]]
+
+> Would have thought this was obviously something you shouldn't do
+> (sorta like running git-annex import on your home directory),
+> but ok, it can skip .git directories. [[done]] --[[Joey]]