optimisation: use graftTree to remember the export branch
Sped up git-annex export in repositories with lots of keys. Old method read whole git-annex branch tree into memory.
This commit is contained in:
parent
1580ff3866
commit
7af55de83c
3 changed files with 9 additions and 10 deletions
|
@ -24,7 +24,7 @@ module Annex.Branch (
|
|||
forceCommit,
|
||||
getBranch,
|
||||
files,
|
||||
graftTreeish,
|
||||
rememberTreeish,
|
||||
performTransitions,
|
||||
withIndex,
|
||||
) where
|
||||
|
@ -646,17 +646,15 @@ getMergedRefs' = do
|
|||
- and then removes it. This ensures that the treeish won't get garbage
|
||||
- collected, and will always be available as long as the git-annex branch
|
||||
- is available. -}
|
||||
graftTreeish :: Git.Ref -> TopFilePath -> Annex ()
|
||||
graftTreeish treeish graftpoint = lockJournal $ \jl -> do
|
||||
rememberTreeish :: Git.Ref -> TopFilePath -> Annex ()
|
||||
rememberTreeish treeish graftpoint = lockJournal $ \jl -> do
|
||||
branchref <- getBranch
|
||||
updateIndex jl branchref
|
||||
Git.Tree.Tree t <- inRepo $
|
||||
Git.Tree.getTree Git.LsTree.LsTreeRecursive branchref
|
||||
t' <- inRepo $ Git.Tree.recordTree $ Git.Tree.Tree $
|
||||
Git.Tree.RecordedSubTree graftpoint treeish [] : t
|
||||
origtree <- fromMaybe (giveup "unable to determine git-annex branch tree") <$>
|
||||
inRepo (Git.Ref.tree branchref)
|
||||
addedt <- inRepo $ Git.Tree.graftTree treeish graftpoint origtree
|
||||
c <- inRepo $ Git.Branch.commitTree Git.Branch.AutomaticCommit
|
||||
"graft" [branchref] t'
|
||||
origtree <- inRepo $ Git.Tree.recordTree (Git.Tree.Tree t)
|
||||
"graft" [branchref] addedt
|
||||
c' <- inRepo $ Git.Branch.commitTree Git.Branch.AutomaticCommit
|
||||
"graft cleanup" [c] origtree
|
||||
inRepo $ Git.Branch.update' fullname c'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue