git-remote-annex: brought back max-git-bundles config
An incremental push that gets converted to a full push due to this config results in the inManifest having just one bundle in it, and the outManifest listing every other bundle. So it actually takes up more space on the special remote. But, it speeds up clone and fetch to not have to download a long series of bundles for incremental pushes.
This commit is contained in:
parent
ce95cac195
commit
2ffe077cc2
4 changed files with 54 additions and 30 deletions
|
@ -273,6 +273,10 @@ fullPush :: State -> Remote -> [Ref] -> Annex (Bool, State)
|
|||
fullPush st rmt refs = guardPush st $ do
|
||||
oldmanifest <- maybe (downloadManifestWhenPresent rmt) pure
|
||||
(manifestCache st)
|
||||
fullPush' oldmanifest st rmt refs
|
||||
|
||||
fullPush' :: Manifest -> State -> Remote -> [Ref] -> Annex (Bool, State)
|
||||
fullPush' oldmanifest st rmt refs = do
|
||||
let bs = map Git.Bundle.fullBundleSpec refs
|
||||
(bundlekey, uploadbundle) <- generateGitBundle rmt bs oldmanifest
|
||||
let manifest = mkManifest [bundlekey] $
|
||||
|
@ -297,14 +301,19 @@ guardPush st a = catchNonAsync a $ \ex -> do
|
|||
incrementalPush :: State -> Remote -> M.Map Ref Sha -> M.Map Ref Sha -> Annex (Bool, State)
|
||||
incrementalPush st rmt oldtrackingrefs newtrackingrefs = guardPush st $ do
|
||||
oldmanifest <- maybe (downloadManifestWhenPresent rmt) pure (manifestCache st)
|
||||
bs <- calc [] (M.toList newtrackingrefs)
|
||||
(bundlekey, uploadbundle) <- generateGitBundle rmt bs oldmanifest
|
||||
let manifest = oldmanifest <> mkManifest [bundlekey] mempty
|
||||
manifest' <- startPush rmt manifest
|
||||
uploadbundle
|
||||
uploadManifest rmt manifest'
|
||||
return (True, st { manifestCache = Nothing })
|
||||
if length (inManifest oldmanifest) + 1 > remoteAnnexMaxGitBundles (Remote.gitconfig rmt)
|
||||
then fullPush' oldmanifest st rmt (M.keys newtrackingrefs)
|
||||
else go oldmanifest
|
||||
where
|
||||
go oldmanifest = do
|
||||
bs <- calc [] (M.toList newtrackingrefs)
|
||||
(bundlekey, uploadbundle) <- generateGitBundle rmt bs oldmanifest
|
||||
let manifest = oldmanifest <> mkManifest [bundlekey] mempty
|
||||
manifest' <- startPush rmt manifest
|
||||
uploadbundle
|
||||
uploadManifest rmt manifest'
|
||||
return (True, st { manifestCache = Nothing })
|
||||
|
||||
calc c [] = return (reverse c)
|
||||
calc c ((ref, sha):refs) = case M.lookup ref oldtrackingrefs of
|
||||
Just oldsha
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue