This commit is contained in:
Joey Hess 2011-10-04 00:40:47 -04:00
parent ff21fd4a65
commit cfe21e85e7
73 changed files with 173 additions and 173 deletions

24
Annex/CatFile.hs Normal file
View file

@ -0,0 +1,24 @@
{- git cat-file interface, with handle automatically stored in the Annex monad
-
- Copyright 2011 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Annex.CatFile (
catFile
) where
import Annex.Common
import qualified Git.CatFile
import qualified Annex
catFile :: String -> FilePath -> Annex String
catFile branch file = maybe startup go =<< Annex.getState Annex.catfilehandle
where
startup = do
g <- gitRepo
h <- liftIO $ Git.CatFile.catFileStart g
Annex.changeState $ \s -> s { Annex.catfilehandle = Just h }
go h
go h = liftIO $ Git.CatFile.catFile h branch file