From ca9ee21bd771e7f94ecd3916f55b10fb3cc8dcbe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 10 Jun 2012 19:58:34 -0400 Subject: crazy optimisation Crazy like a fox.. --- Annex/CatFile.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Annex/CatFile.hs') diff --git a/Annex/CatFile.hs b/Annex/CatFile.hs index bcf44551e..afb14c67f 100644 --- a/Annex/CatFile.hs +++ b/Annex/CatFile.hs @@ -8,6 +8,7 @@ module Annex.CatFile ( catFile, catObject, + catObjectDetails, catFileHandle ) where @@ -17,6 +18,7 @@ import Common.Annex import qualified Git import qualified Git.CatFile import qualified Annex +import Git.Types catFile :: Git.Branch -> FilePath -> Annex L.ByteString catFile branch file = do @@ -28,6 +30,11 @@ catObject ref = do h <- catFileHandle liftIO $ Git.CatFile.catObject h ref +catObjectDetails :: Git.Ref -> Annex (Maybe (L.ByteString, Sha)) +catObjectDetails ref = do + h <- catFileHandle + liftIO $ Git.CatFile.catObjectDetails h ref + catFileHandle :: Annex Git.CatFile.CatFileHandle catFileHandle = maybe startup return =<< Annex.getState Annex.catfilehandle where -- cgit v1.2.3