diff --git a/Annex/RepoSize.hs b/Annex/RepoSize.hs index d7c0f0a436..ff053ba03f 100644 --- a/Annex/RepoSize.hs +++ b/Annex/RepoSize.hs @@ -126,7 +126,9 @@ diffBranchRepoSizes quiet oldsizemap oldbranchsha newbranchsha = do newsizemap <- readpairs 100000 reader oldsizemap Nothing liftIO $ wait feedtid ifM (liftIO cleanup) - ( return (newsizemap, newbranchsha) + ( do + newsizemap' <- addemptyrepos newsizemap + return (newsizemap', newbranchsha) , return (oldsizemap, oldbranchsha) ) where @@ -156,3 +158,10 @@ diffBranchRepoSizes quiet oldsizemap oldbranchsha newbranchsha = do readpairs n' reader sizemap' Nothing Nothing -> return sizemap parselog = maybe mempty (S.fromList . parseLoggedLocationsWithoutClusters) + + addemptyrepos newsizemap = do + knownuuids <- M.keys <$> uuidDescMap + return $ foldl' + (\m u -> M.insertWith (flip const) u (RepoSize 0) m) + newsizemap + knownuuids diff --git a/Command/MaxSize.hs b/Command/MaxSize.hs index 58684311b6..c6d2ff0aad 100644 --- a/Command/MaxSize.hs +++ b/Command/MaxSize.hs @@ -76,9 +76,16 @@ sizeOverview o = do descmap <- Remote.uuidDescriptions deadset <- S.fromList <$> trustGet DeadTrusted maxsizes <- getMaxSizes - reposizes <- flip M.withoutKeys deadset <$> getRepoSizes True + reposizes <- getRepoSizes True + -- Add repos too new and empty to have a reposize, + -- whose maxsize has been set. + let reposizes' = foldl' + (\m u -> M.insertWith (flip const) u (RepoSize 0) m) + reposizes + (M.keys maxsizes) + let reposizes'' = flip M.withoutKeys deadset reposizes' let l = reverse $ sortOn snd $ M.toList $ - M.mapWithKey (gather maxsizes) reposizes + M.mapWithKey (gather maxsizes) reposizes'' v <- Remote.prettyPrintUUIDsWith' False (Just "size") "repositories" descmap showsizes l showRaw $ encodeBS $ tablerow (zip widths headers) @@ -89,11 +96,10 @@ sizeOverview o = do sizefield = "size" :: T.Text maxsizefield = "maxsize" :: T.Text - gather maxsizes u (RepoSize currsize) = Just $ - M.fromList - [ (sizefield, Just currsize) - , (maxsizefield, fromMaxSize <$> M.lookup u maxsizes) - ] + gather maxsizes u (RepoSize currsize) = Just $ M.fromList + [ (sizefield, Just currsize) + , (maxsizefield, fromMaxSize <$> M.lookup u maxsizes) + ] (widths, headers) = unzip [ (7, "size") diff --git a/doc/todo/git-annex_proxies.mdwn b/doc/todo/git-annex_proxies.mdwn index f8a7dbdd06..14520d0a03 100644 --- a/doc/todo/git-annex_proxies.mdwn +++ b/doc/todo/git-annex_proxies.mdwn @@ -35,21 +35,6 @@ Planned schedule of work: * `git-annex assist --rebalance` of `balanced=foo:2` sometimes needs several runs to stabalize. -* Bug: - - git init foo - cd foo - git-annex init - git commit --allow-empty -m foo - cd .. - git clone foo bar - cd foo - git remote add bar ../bar - git-annex maxsize bar - - Now `git-annex maxsize` will omit displaying bar. This is because the - DB got written without it. - * Concurrency issues with RepoSizes calculation and balanced content: * What if 2 concurrent threads are considering sending two different