Optimised union merging; now only runs git cat-file once.

This commit is contained in:
Joey Hess 2011-11-12 17:45:12 -04:00
parent cea65b9e5b
commit 04edae6791
7 changed files with 62 additions and 36 deletions

View file

@ -149,7 +149,8 @@ update = onceonly $ do
- documentation advises users not to directly
- modify the branch.
-}
inRepo $ \g -> Git.UnionMerge.merge_index g branches
h <- catFileHandle
inRepo $ \g -> Git.UnionMerge.merge_index h g branches
ff <- if dirty then return False else tryFastForwardTo refs
unless ff $ inRepo $
Git.commit merge_desc fullname (nub $ fullname:refs)
@ -280,7 +281,7 @@ get' staleok file = fromcache =<< getCache file
fromjournal Nothing
| staleok = withIndex frombranch
| otherwise = withIndexUpdate $ frombranch >>= cache
frombranch = catFile fullname file
frombranch = L.unpack <$> catFile fullname file
cache content = do
setCache file content
return content