diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-02-23 22:03:47 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-02-23 22:03:47 -0400 |
commit | 3ebc019a709e1cd5c195a374e9a8db401384deba (patch) | |
tree | bc922c4a3b8e0b6fbaba070272221a92228a7d1b | |
parent | 33e442ce1f5ce4df677674dbcd272125a8405803 (diff) |
few strictness improvemnets
-rw-r--r-- | Git/Tree.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Git/Tree.hs b/Git/Tree.hs index fd059fd7c..6ecfcf9ce 100644 --- a/Git/Tree.hs +++ b/Git/Tree.hs @@ -119,7 +119,6 @@ adjustTree adjust r repo = do (l, cleanup) <- liftIO $ lsTreeWithObjects r repo h <- liftIO $ startRecordTree repo (l', _, _) <- go h False [] topTree l - liftIO $ print l' sha <- liftIO $ mkTree h l' liftIO $ CoProcess.stop h void $ liftIO cleanup @@ -135,15 +134,16 @@ adjustTree adjust r repo = do case v of Nothing -> go h True c intree is Just ti'@(TreeItem f m s) -> - let modified = ti' /= ti + let !modified = wasmodified || ti' /= ti blob = TreeBlob f m s - in go h (wasmodified || modified) (blob:c) intree is + in go h modified (blob:c) intree is Just TreeObject -> do (sl, modified, is') <- go h False [] (subTree i) is subtree <- if modified then liftIO $ recordSubTree h $ NewSubTree (LsTree.file i) sl else return $ RecordedSubTree (LsTree.file i) (LsTree.sha i) [] - go h (modified || wasmodified) (subtree : c) intree is' + let !modified' = modified || wasmodified + go h modified' (subtree : c) intree is' _ -> error ("unexpected object type \"" ++ LsTree.typeobj i ++ "\"") | otherwise = return (c, wasmodified, i:is) @@ -177,6 +177,6 @@ topTree :: InTree topTree = notElem '/' . getTopFilePath . LsTree.file subTree :: LsTree.TreeItem -> InTree -subTree i = - let prefix = getTopFilePath (LsTree.file i) ++ "/" +subTree t = + let prefix = getTopFilePath (LsTree.file t) ++ "/" in (\i -> prefix `isPrefixOf` getTopFilePath (LsTree.file i)) |