diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 16114ffdb2..5ca39b8b5c 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -36,23 +36,22 @@ dirContents d = map (d ) . filter (not . dirCruft) <$> getDirectoryContents d - and lazily. If the directory does not exist, no exception is thrown, - instead, [] is returned. -} dirContentsRecursive :: FilePath -> IO [FilePath] -dirContentsRecursive topdir = dirContentsRecursive' topdir [""] +dirContentsRecursive topdir = dirContentsRecursive' [topdir] -dirContentsRecursive' :: FilePath -> [FilePath] -> IO [FilePath] -dirContentsRecursive' _ [] = return [] -dirContentsRecursive' topdir (dir:dirs) = unsafeInterleaveIO $ do - (files, dirs') <- collect [] [] =<< catchDefaultIO [] (dirContents (topdir dir)) - files' <- dirContentsRecursive' topdir (dirs' ++ dirs) +dirContentsRecursive' :: [FilePath] -> IO [FilePath] +dirContentsRecursive' [] = return [] +dirContentsRecursive' (dir:dirs) = unsafeInterleaveIO $ do + (files, dirs') <- collect [] [] =<< catchDefaultIO [] (dirContents dir) + files' <- dirContentsRecursive' (dirs' ++ dirs) return (files ++ files') where collect files dirs' [] = return (reverse files, reverse dirs') collect files dirs' (entry:entries) | dirCruft entry = collect files dirs' entries | otherwise = do - let dirEntry = dir entry - ifM (doesDirectoryExist $ topdir dirEntry) - ( collect files (dirEntry:dirs') entries - , collect (dirEntry:files) dirs' entries + ifM (doesDirectoryExist entry) + ( collect files (entry:dirs') entries + , collect (entry:files) dirs' entries ) {- Moves one filename to another. diff --git a/debian/changelog b/debian/changelog index b24b102d44..6ddcbc39b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +git-annex (3.20121127) UNRELEASED; urgency=low + + * Fix dirContentsRecursive, which had missed some files in deeply nested + subdirectories. Could affect various parts of git-annex. + + -- Joey Hess Mon, 26 Nov 2012 16:45:19 -0400 + git-annex (3.20121126) unstable; urgency=low * New webdav and Amazon glacier special remotes.