[darcs-devel] [patch1180] Garbage collection of global cache.
Ganesh Sittampalam
bugs at darcs.net
Wed Jul 16 23:13:18 UTC 2014
Ganesh Sittampalam <ganesh at earth.li> added the comment:
Some partial comments:
> hunk ./src/Darcs/Repository/HashedRepo.hs 670
> -- with inventory" hashes. This function does not attempt to download
missing
> -- inventory files.
> -listPatchesLocal :: IO [String]
> -listPatchesLocal = do
> - inventory <- readInventoryPrivate darcsdir hashedInventory
> +listPatchesLocal :: String -> IO [String]
> +listPatchesLocal darcsDir = do
> + inventory <- readInventoryPrivate darcsDir hashedInventory
> followStartingWiths (fst inventory) (getPatches inventory)
> where
> followStartingWiths Nothing patches = return patches
How does this interact with lazy repositories, as we discussed last week?
I think we also discussed an approach of just GCing the user
repositories first, then GCing the global cache. Which algorithm is
being used in this patch?
> hunk ./src/Darcs/Repository/HashedRepo.hs 658
> if b then readInventoryPrivate dir invName
> else return (Nothing, [])
>
> -
> -- |listInventoriesLocal this function does not attempt to retrieve
missing
> -- inventory files.
> listInventoriesLocal :: IO [String]
Please amend out this unnecessary whitespace change (adds noise, risk of
conflicts with other changes).
> +-- | getRecursiveDarcsRepos returns all directories under topdir that
have
> +-- a child directory named darcsdir ("_darcs").
> +getRecursiveDarcsRepos :: FilePath -> IO [FilePath]
> +getRecursiveDarcsRepos topdir = do
> + names <- getDirectoryContents topdir
> + let properNames = filter (`notElem` [".", ".."]) names
> + paths <- forM properNames $ \name -> do
> + let path = topdir </> name
> + isDir <- doesDirectoryExist path
> + if isDir && (name /= darcsdir)
> + then getRecursiveDarcsRepos path
> + else if name == darcsdir
This logic feels a bit convoluted. Wouldn't it lead to a file named
"_darcs" being recognised? I think the outer if should check 'isDir',
and the inner if check 'name == darcsdir'
__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1180>
__________________________________
More information about the darcs-devel
mailing list