aboutsummaryrefslogtreecommitdiff
path: root/Annex/View.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-14 15:58:46 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-14 15:58:46 -0400
commit90db9740d0d64b34f2e46f57f8aaca235088734c (patch)
treeac4d7e1b03bfcc337d02569acb87a1481f610746 /Annex/View.hs
parent9b29bd39c8dbf23bdf6930b51aba13992ccc49de (diff)
Sped up git-annex add in direct mode and v6 by using git hash-object --batch.
Speeds up hashSymlink and hashPointerFile.
Diffstat (limited to 'Annex/View.hs')
-rw-r--r--Annex/View.hs20
1 files changed, 9 insertions, 11 deletions
diff --git a/Annex/View.hs b/Annex/View.hs
index 14c3eccad..0078c2cad 100644
--- a/Annex/View.hs
+++ b/Annex/View.hs
@@ -19,7 +19,7 @@ import qualified Git.LsFiles
import qualified Git.Ref
import Git.UpdateIndex
import Git.Sha
-import Git.HashObject
+import Annex.HashObject
import Git.Types
import Git.FilePath
import Annex.WorkTree
@@ -340,38 +340,36 @@ applyView' mkviewedfile getfilemetadata view = do
(l, clean) <- inRepo $ Git.LsFiles.inRepo [top]
liftIO . nukeFile =<< fromRepo gitAnnexViewIndex
uh <- withViewIndex $ inRepo Git.UpdateIndex.startUpdateIndex
- hasher <- inRepo hashObjectStart
forM_ l $ \f -> do
relf <- getTopFilePath <$> inRepo (toTopFilePath f)
- go uh hasher relf =<< lookupFile f
+ go uh relf =<< lookupFile f
liftIO $ do
- hashObjectStop hasher
void $ stopUpdateIndex uh
void clean
genViewBranch view
where
genviewedfiles = viewedFiles view mkviewedfile -- enables memoization
- go uh hasher f (Just k) = do
+ go uh f (Just k) = do
metadata <- getCurrentMetaData k
let metadata' = getfilemetadata f `unionMetaData` metadata
forM_ (genviewedfiles f metadata') $ \fv -> do
f' <- fromRepo $ fromTopFilePath $ asTopFilePath fv
- stagesymlink uh hasher f' =<< calcRepo (gitAnnexLink f' k)
- go uh hasher f Nothing
+ stagesymlink uh f' =<< calcRepo (gitAnnexLink f' k)
+ go uh f Nothing
| "." `isPrefixOf` f = do
s <- liftIO $ getSymbolicLinkStatus f
if isSymbolicLink s
- then stagesymlink uh hasher f =<< liftIO (readSymbolicLink f)
+ then stagesymlink uh f =<< liftIO (readSymbolicLink f)
else do
- sha <- liftIO $ Git.HashObject.hashFile hasher f
+ sha <- hashFile f
let blobtype = if isExecutable (fileMode s)
then ExecutableBlob
else FileBlob
liftIO . Git.UpdateIndex.streamUpdateIndex' uh
=<< inRepo (Git.UpdateIndex.stageFile sha blobtype f)
| otherwise = noop
- stagesymlink uh hasher f linktarget = do
- sha <- hashSymlink' hasher linktarget
+ stagesymlink uh f linktarget = do
+ sha <- hashSymlink linktarget
liftIO . Git.UpdateIndex.streamUpdateIndex' uh
=<< inRepo (Git.UpdateIndex.stageSymlink f sha)