Fix bug that prevented enumerating locally present objects in repos tuned with annex.tune.objecthash1=true

Need to walk 1 level of subdirs less in this case.

The git-annex branch traversal code didn't have a similar bug.
This commit is contained in:
Joey Hess 2015-06-11 15:14:42 -04:00
parent c558b39686
commit 0a998032ed
3 changed files with 14 additions and 2 deletions

View file

@ -521,11 +521,12 @@ getKeysPresent keyloc = do
direct <- isDirect
dir <- fromRepo gitAnnexObjectDir
s <- getstate direct
liftIO $ walk s direct (2 :: Int) dir
depth <- gitAnnexLocationDepth <$> Annex.getGitConfig
liftIO $ walk s direct depth dir
where
walk s direct depth dir = do
contents <- catchDefaultIO [] (dirContents dir)
if depth == 0
if depth < 2
then do
contents' <- filterM (present s direct) contents
let keys = mapMaybe (fileKey . takeFileName) contents'

View file

@ -13,6 +13,7 @@ module Locations (
annexDir,
objectDir,
gitAnnexLocation,
gitAnnexLocationDepth,
gitAnnexLink,
gitAnnexContentLock,
gitAnnexMapping,
@ -115,6 +116,13 @@ annexLocations config key = map (annexLocation config key) dirHashes
annexLocation :: GitConfig -> Key -> (HashLevels -> Hasher) -> FilePath
annexLocation config key hasher = objectDir </> keyPath key (hasher $ objectHashLevels config)
{- Number of subdirectories from the gitAnnexObjectDir
- to the gitAnnexLocation. -}
gitAnnexLocationDepth :: GitConfig -> Int
gitAnnexLocationDepth config = hashlevels + 1
where
HashLevels hashlevels = objectHashLevels config
{- Annexed object's location in a repository.
-
- When there are multiple possible locations, returns the one where the

3
debian/changelog vendored
View file

@ -25,6 +25,9 @@ git-annex (5.20150529) UNRELEASED; urgency=medium
to avoid old versions of tahoe create-client choking.
* Build documentation with deterministic=1 for reproducible builds.
(A new ikiwiki feature.) Closes: #785736
* Fix bug that prevented enumerating locally present objects in repos
tuned with annex.tune.objecthash1=true.
Fixes: unused, object count in info, unannex.
-- Joey Hess <id@joeyh.name> Sat, 30 May 2015 02:07:18 -0400