diff options
Diffstat (limited to 'Annex/Branch.hs')
-rw-r--r-- | Annex/Branch.hs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 6ef778801..32aef28a9 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -45,7 +45,8 @@ import qualified Git.Branch import qualified Git.UnionMerge import qualified Git.UpdateIndex import Git.LsTree (lsTreeParams) -import Git.HashObject +import qualified Git.HashObject +import Annex.HashObject import Git.Types import Git.FilePath import Annex.CatFile @@ -342,8 +343,9 @@ genIndex g = Git.UpdateIndex.streamUpdateIndex g mergeIndex :: JournalLocked -> [Git.Ref] -> Annex () mergeIndex jl branches = do prepareModifyIndex jl - h <- catFileHandle - inRepo $ \g -> Git.UnionMerge.mergeIndex h g branches + hashhandle <- hashObjectHandle + ch <- catFileHandle + inRepo $ \g -> Git.UnionMerge.mergeIndex hashhandle ch g branches {- Removes any stale git lock file, to avoid git falling over when - updating the index. @@ -423,11 +425,10 @@ stageJournal jl = withIndex $ do let dir = gitAnnexJournalDir g (jlogf, jlogh) <- openjlog liftIO $ fileEncoding jlogh - withJournalHandle $ \jh -> do - h <- hashObjectStart g + h <- hashObjectHandle + withJournalHandle $ \jh -> Git.UpdateIndex.streamUpdateIndex g [genstream dir h jh jlogh] - hashObjectStop h return $ cleanup dir jlogh jlogf where genstream dir h jh jlogh streamer = do @@ -437,7 +438,7 @@ stageJournal jl = withIndex $ do Just file -> do unless (dirCruft file) $ do let path = dir </> file - sha <- hashFile h path + sha <- Git.HashObject.hashFile h path hPutStrLn jlogh file streamer $ Git.UpdateIndex.updateIndexLine sha FileBlob (asTopFilePath $ fileJournal file) @@ -549,13 +550,11 @@ performTransitionsLocked jl ts neednewlocalbranch transitionedrefs = do run changers = do trustmap <- calcTrustMap <$> getRaw trustLog fs <- branchFiles - hasher <- inRepo hashObjectStart forM_ fs $ \f -> do content <- getRaw f - apply changers hasher f content trustmap - liftIO $ hashObjectStop hasher - apply [] _ _ _ _ = return () - apply (changer:rest) hasher file content trustmap = + apply changers f content trustmap + apply [] _ _ _ = return () + apply (changer:rest) file content trustmap = case changer file content trustmap of RemoveFile -> do Annex.Queue.addUpdateIndex @@ -564,12 +563,12 @@ performTransitionsLocked jl ts neednewlocalbranch transitionedrefs = do -- transitions on it. return () ChangeFile content' -> do - sha <- inRepo $ hashObject BlobObject content' + sha <- hashBlob content' Annex.Queue.addUpdateIndex $ Git.UpdateIndex.pureStreamer $ Git.UpdateIndex.updateIndexLine sha FileBlob (asTopFilePath file) - apply rest hasher file content' trustmap + apply rest file content' trustmap PreserveFile -> - apply rest hasher file content trustmap + apply rest file content trustmap checkBranchDifferences :: Git.Ref -> Annex () checkBranchDifferences ref = do |