diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-06-11 15:14:42 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-06-11 15:15:05 -0400 |
commit | 0d30987f8780d51ea144f2fca9f6482b15c2b71d (patch) | |
tree | c58e9cd90566be449711eeaf76afca3fd9b4d022 | |
parent | 40b52623536beb978d3bcc941b8a87a12010cbac (diff) |
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.
-rw-r--r-- | Annex/Content.hs | 5 | ||||
-rw-r--r-- | Locations.hs | 8 | ||||
-rw-r--r-- | debian/changelog | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 5e7dd322b..397eb4061 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -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' diff --git a/Locations.hs b/Locations.hs index 8b0b819e6..3076fc7cd 100644 --- a/Locations.hs +++ b/Locations.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index f1179919d..21811ae18 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 |