@@ -1,7 +1,24 @@
1diff -ru orig/Git/S3.hs new/Git/S3.hs
1diff -ru orig/Git/S3.hs new/Git/S3.hs
2−--- orig/Git/S3.hs 2014-04-04 10:00:47.080423588 +0300
2+--- orig/Git/S3.hs 2014-04-06 09:02:47.247789820 +0300
3−+++ new/Git/S3.hs 2014-04-04 10:00:46.000000000 +0300
3++++ new/Git/S3.hs 2014-04-06 09:02:47.000000000 +0300
4−@@ -467,7 +467,10 @@
4+@@ -42,7 +42,6 @@
5+ import Control.Monad.Trans.Resource
7+ import Data.Aeson as A
10+ import Data.Binary as Bin
11+ import Data.ByteString (ByteString)
14+ deriving (Eq, Show, Generic)
16+-type MonadS3 m = (Failure Git.GitException m,
17++type MonadS3 m = (MonadThrow m,
18+ MonadIO m, MonadBaseControl IO m, MonadLogger m)
20+ data BackendCallbacks = BackendCallbacks
5 -> ResourceT m (Response (ResponseMetadata a) a)
22 -> ResourceT m (Response (ResponseMetadata a) a)
6 awsRetry cfg svcfg mgr r =
23 awsRetry cfg svcfg mgr r =
7 transResourceT liftIO $
24 transResourceT liftIO $
@@ -13,7 +30,16 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
14 listBucketS3 :: MonadS3 m => OdbS3Details -> ResourceT m [Text]
31 listBucketS3 :: MonadS3 m => OdbS3Details -> ResourceT m [Text]
15 listBucketS3 dets = do
32 listBucketS3 dets = do
16−@@ -623,7 +626,7 @@
33+@@ -622,7 +624,7 @@
35+ modifyIORef mshas (sha:)
37+- checkResult r "lgForEachObject failed"
38++ either throwM return $ checkResult r "lgForEachObject failed"
40+ -- Update the known objects map with the fact that we've got a local cache
17 ++ show (Prelude.length shas) ++ " objects"
43 ++ show (Prelude.length shas) ++ " objects"
18 return shas
44 return shas
@@ -22,7 +48,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
22 => OdbS3Details -> Text -> FilePath -> m [SHA]
48 => OdbS3Details -> Text -> FilePath -> m [SHA]
23 catalogPackFile dets packSha idxPath = do
49 catalogPackFile dets packSha idxPath = do
24 -- Load the pack file, and iterate over the objects within it to determine
50 -- Load the pack file, and iterate over the objects within it to determine
25−@@ -687,7 +690,7 @@
51+@@ -710,7 +712,7 @@
26 lgDebug $ "cacheUpdateEntry " ++ show (shaToText sha) ++ " " ++ show ce
52 lgDebug $ "cacheUpdateEntry " ++ show (shaToText sha) ++ " " ++ show ce
27 liftIO $ atomically $ modifyTVar (knownObjects dets) $ M.insert sha ce
53 liftIO $ atomically $ modifyTVar (knownObjects dets) $ M.insert sha ce
@@ -31,7 +57,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
31 => OdbS3Details -> SHA -> CacheEntry -> Bool
57 => OdbS3Details -> SHA -> CacheEntry -> Bool
32 -> m (Maybe ObjectInfo)
58 -> m (Maybe ObjectInfo)
33 cacheLoadObject dets sha ce metadataOnly = do
59 cacheLoadObject dets sha ce metadataOnly = do
34−@@ -931,7 +934,7 @@
60+@@ -958,7 +960,7 @@
35 remoteStoreObject _ _ _ =
61 remoteStoreObject _ _ _ =
36 throw (Git.BackendError "remoteStoreObject was not given any data")
62 throw (Git.BackendError "remoteStoreObject was not given any data")
@@ -40,7 +66,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
40 => OdbS3Details -> ResourceT m ()
66 => OdbS3Details -> ResourceT m ()
41 remoteCatalogContents dets = do
67 remoteCatalogContents dets = do
42 lgDebug "remoteCatalogContents"
68 lgDebug "remoteCatalogContents"
43−@@ -955,7 +958,7 @@
69+@@ -982,7 +984,7 @@
45 | otherwise -> return ()
71 | otherwise -> return ()
@@ -49,7 +75,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
49 => OdbS3Details -> SHA -> Bool -> m (Maybe CacheEntry)
75 => OdbS3Details -> SHA -> Bool -> m (Maybe CacheEntry)
50 accessObject dets sha checkRemote = do
76 accessObject dets sha checkRemote = do
51 mentry <- cacheLookupEntry dets sha
77 mentry <- cacheLookupEntry dets sha
52−@@ -1000,19 +1003,19 @@
78+@@ -1032,19 +1034,19 @@
53 -- cache and with the callback interface. This is to avoid recataloging
79 -- cache and with the callback interface. This is to avoid recataloging
54 -- in the future.
80 -- in the future.
@@ -72,7 +98,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
72 => OdbS3Details -> SHA -> m (Maybe ObjectInfo)
98 => OdbS3Details -> SHA -> m (Maybe ObjectInfo)
73 readObjectMetadata dets sha = readObject dets sha True
99 readObjectMetadata dets sha = readObject dets sha True
75−@@ -1022,7 +1025,7 @@
101+@@ -1054,7 +1056,7 @@
76 callbackRegisterObject dets sha info
102 callbackRegisterObject dets sha info
77 cacheStoreObject dets sha info
103 cacheStoreObject dets sha info
@@ -81,7 +107,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
81 => OdbS3Details -> BL.ByteString -> m ()
107 => OdbS3Details -> BL.ByteString -> m ()
82 writePackFile dets bytes = do
108 writePackFile dets bytes = do
83 let dir = tempDirectory dets
109 let dir = tempDirectory dets
84−@@ -1041,7 +1044,7 @@
110+@@ -1073,7 +1075,7 @@
85 shas <- catalogPackFile dets packSha idxPath
111 shas <- catalogPackFile dets packSha idxPath
86 callbackRegisterPackFile dets packSha shas
112 callbackRegisterPackFile dets packSha shas
@@ -90,7 +116,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
90 => Ptr (Ptr ())
116 => Ptr (Ptr ())
91 -> Ptr CSize
117 -> Ptr CSize
92 -> Ptr C'git_otype
118 -> Ptr C'git_otype
93−@@ -1072,7 +1075,7 @@
119+@@ -1104,7 +1106,7 @@
94 BU.unsafeUseAsCString chunk $ copyBytes p ?? len
120 BU.unsafeUseAsCString chunk $ copyBytes p ?? len
95 return $ p `plusPtr` len
121 return $ p `plusPtr` len
@@ -99,7 +125,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
99 => Ptr C'git_oid
125 => Ptr C'git_oid
100 -> Ptr (Ptr ())
126 -> Ptr (Ptr ())
101 -> Ptr CSize
127 -> Ptr CSize
102−@@ -1108,7 +1111,7 @@
128+@@ -1140,7 +1142,7 @@
103 go dets sha False
129 go dets sha False
104 | otherwise = return Nothing
130 | otherwise = return Nothing
@@ -108,7 +134,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
108 => Ptr CSize
134 => Ptr CSize
109 -> Ptr C'git_otype
135 -> Ptr C'git_otype
110 -> Ptr C'git_odb_backend
136 -> Ptr C'git_odb_backend
111−@@ -1126,7 +1129,7 @@
137+@@ -1158,7 +1160,7 @@
112 poke len_p (toLength len)
138 poke len_p (toLength len)
113 poke type_p (toType typ)
139 poke type_p (toType typ)
@@ -117,7 +143,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
117 => Ptr C'git_oid
143 => Ptr C'git_oid
118 -> Ptr C'git_odb_backend
144 -> Ptr C'git_odb_backend
119 -> Ptr ()
145 -> Ptr ()
120−@@ -1152,7 +1155,7 @@
146+@@ -1184,7 +1186,7 @@
121 (ObjectInfo (fromLength len) (fromType obj_type)
147 (ObjectInfo (fromLength len) (fromType obj_type)
122 Nothing (Just (BL.fromChunks [bytes])))
148 Nothing (Just (BL.fromChunks [bytes])))
@@ -126,7 +152,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
126 => Ptr C'git_odb_backend -> Ptr C'git_oid -> CInt -> m CInt
152 => Ptr C'git_odb_backend -> Ptr C'git_oid -> CInt -> m CInt
127 existsCallback be oid confirmNotExists = do
153 existsCallback be oid confirmNotExists = do
128 (dets, sha) <- liftIO $ unpackDetails be oid
154 (dets, sha) <- liftIO $ unpackDetails be oid
129−@@ -1162,18 +1165,18 @@
155+@@ -1194,18 +1196,18 @@
130 return $ if ce == DoesNotExist then 0 else 1)
156 return $ if ce == DoesNotExist then 0 else 1)
131 (return c'GIT_ERROR)
157 (return c'GIT_ERROR)
@@ -148,7 +174,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
148 => Ptr (Ptr C'git_odb_writepack)
174 => Ptr (Ptr C'git_odb_writepack)
149 -> Ptr C'git_odb_backend
175 -> Ptr C'git_odb_backend
150 -> C'git_transfer_progress_callback
176 -> C'git_transfer_progress_callback
151−@@ -1214,7 +1217,7 @@
177+@@ -1248,7 +1250,7 @@
152 foreign import ccall "&freeCallback"
178 foreign import ccall "&freeCallback"
153 freeCallbackPtr :: FunPtr F'git_odb_backend_free_callback
179 freeCallbackPtr :: FunPtr F'git_odb_backend_free_callback
@@ -157,7 +183,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
157 => Ptr C'git_odb_writepack
183 => Ptr C'git_odb_writepack
158 -> Ptr ()
184 -> Ptr ()
160−@@ -1233,7 +1236,7 @@
186+@@ -1267,7 +1269,7 @@
161 (castPtr dataPtr) (fromIntegral len)
187 (castPtr dataPtr) (fromIntegral len)
162 writePackFile dets (BL.fromChunks [bytes])
188 writePackFile dets (BL.fromChunks [bytes])
@@ -166,7 +192,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
166 => Ptr C'git_odb_writepack -> Ptr C'git_transfer_progress
192 => Ptr C'git_odb_writepack -> Ptr C'git_transfer_progress
167 -> m CInt
193 -> m CInt
168 packCommitCallback _wp _progress =
194 packCommitCallback _wp _progress =
169−@@ -1346,7 +1349,7 @@
195+@@ -1380,7 +1382,7 @@
170 liftIO $ writeIORef result res
196 liftIO $ writeIORef result res
171 readIORef result
197 readIORef result
@@ -175,7 +201,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
175 => Aws.S3Configuration NormalQuery
201 => Aws.S3Configuration NormalQuery
176 -> Configuration
202 -> Configuration
177 -> Manager
203 -> Manager
178−@@ -1439,7 +1442,7 @@
204+@@ -1475,7 +1477,7 @@
180 -- | Given a repository object obtained from Libgit2, add an S3 backend to it,
206 -- | Given a repository object obtained from Libgit2, add an S3 backend to it,
181 -- making it the primary store for objects associated with that repository.
207 -- making it the primary store for objects associated with that repository.
@@ -184,7 +210,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
184 => LgRepo
210 => LgRepo
185 -> Text -- ^ bucket
211 -> Text -- ^ bucket
186 -> Text -- ^ prefix
212 -> Text -- ^ prefix
187−@@ -1469,7 +1472,7 @@
213+@@ -1505,7 +1507,7 @@
188 void $ liftIO $ odbBackendAdd repo odbS3 100
214 void $ liftIO $ odbBackendAdd repo odbS3 100
189 return repo
215 return repo
@@ -193,7 +219,7 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
193 => Maybe Text -> Text -> Text -> FilePath -> BackendCallbacks
219 => Maybe Text -> Text -> Text -> FilePath -> BackendCallbacks
194 -> Git.RepositoryFactory (ReaderT LgRepo (NoLoggingT m)) m LgRepo
220 -> Git.RepositoryFactory (ReaderT LgRepo (NoLoggingT m)) m LgRepo
195 s3Factory bucket accessKey secretKey dir callbacks = lgFactory
221 s3Factory bucket accessKey secretKey dir callbacks = lgFactory
196−@@ -1492,7 +1495,7 @@
222+@@ -1528,7 +1530,7 @@
198 callbacks
224 callbacks
@@ -203,9 +229,23 @@ diff -ru orig/Git/S3.hs new/Git/S3.hs
203 -> Git.RepositoryFactory (ReaderT LgRepo m) m LgRepo
229 -> Git.RepositoryFactory (ReaderT LgRepo m) m LgRepo
204 s3FactoryLogger bucket accessKey secretKey dir callbacks = lgFactoryLogger
230 s3FactoryLogger bucket accessKey secretKey dir callbacks = lgFactoryLogger
205diff -ru orig/gitlib-s3.cabal new/gitlib-s3.cabal
231diff -ru orig/gitlib-s3.cabal new/gitlib-s3.cabal
206−--- orig/gitlib-s3.cabal 2014-04-04 10:00:47.084423588 +0300
232+--- orig/gitlib-s3.cabal 2014-04-06 09:02:47.247789820 +0300
207−+++ new/gitlib-s3.cabal 2014-04-04 10:00:46.000000000 +0300
233++++ new/gitlib-s3.cabal 2014-04-06 09:02:47.000000000 +0300
208−@@ -58,6 +58,7 @@
234+@@ -33,7 +33,6 @@
235+ , hspec-expectations >= 0.3
236+ , data-default >= 0.5.1
237+ , directory >= 1.1.0.2
238+- , failure >= 0.2.0.1
240+ , monad-logger >= 0.3.1.1
241+ , resourcet >= 0.4.6
244+ , hlibgit2 >= 0.18.0.11
248+ , bifunctors >= 3.2.0.1
209 , binary >= 0.5.1.0
249 , binary >= 0.5.1.0
210 , bytestring >= 0.9.2.1
250 , bytestring >= 0.9.2.1
211 , conduit >= 0.5.5
251 , conduit >= 0.5.5
@@ -214,14 +254,23 @@ diff -ru orig/gitlib-s3.cabal new/gitlib-s3.cabal
214 , directory >= 1.1.0.2
254 , directory >= 1.1.0.2
215 , filepath >= 1.3.0
255 , filepath >= 1.3.0
216diff -ru orig/test/Smoke.hs new/test/Smoke.hs
256diff -ru orig/test/Smoke.hs new/test/Smoke.hs
217−--- orig/test/Smoke.hs 2014-04-04 10:00:47.080423588 +0300
257+--- orig/test/Smoke.hs 2014-04-06 09:02:47.247789820 +0300
218−+++ new/test/Smoke.hs 2014-04-04 10:00:46.000000000 +0300
258++++ new/test/Smoke.hs 2014-04-06 09:02:47.000000000 +0300
219−@@ -31,7 +31,7 @@
259+@@ -11,7 +11,6 @@
262+ import Control.Applicative
263+-import Control.Failure
264+ import Control.Monad.IO.Class
265+ import Control.Monad.Logger
266+ import Control.Monad.Trans.Reader
268+ import Test.Hspec.Runner
221 s3Factory
270 s3Factory
222− :: (Failure Git.GitException m, MonadIO m, MonadBaseControl IO m,
271+- :: (Failure Git.GitException m, MonadIO m, MonadBaseControl IO m,
223- MonadUnsafeIO m, MonadThrow m)
272- MonadUnsafeIO m, MonadThrow m)
224−+ MonadThrow m)
273++ :: (MonadThrow m, MonadIO m, MonadBaseControl IO m)
225 => Git.RepositoryFactory (ReaderT Lg.LgRepo (NoLoggingT m)) m Lg.LgRepo
274 => Git.RepositoryFactory (ReaderT Lg.LgRepo (NoLoggingT m)) m Lg.LgRepo
226 s3Factory = Lg.lgFactory
275 s3Factory = Lg.lgFactory
227 { Git.runRepository = \ctxt m ->
276 { Git.runRepository = \ctxt m ->