From a52baf227a96eea58e2891136ac3b41f8de635cd Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Sun, 2 Apr 2023 13:44:05 +0300 Subject: [PATCH] hbs2-git db bugfix --- hbs2-git/lib/HBS2Git/Export.hs | 9 +++++---- hbs2-git/lib/HBS2Git/State.hs | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hbs2-git/lib/HBS2Git/Export.hs b/hbs2-git/lib/HBS2Git/Export.hs index 26839719..5c2a36e1 100644 --- a/hbs2-git/lib/HBS2Git/Export.hs +++ b/hbs2-git/lib/HBS2Git/Export.hs @@ -77,8 +77,8 @@ export h repoHead = do notice "calculate dependencies" - for_ refs $ \(_, h) -> do - liftIO $ gitGetTransitiveClosure cache mempty h <&> Set.toList + for_ refs $ \(_, r) -> do + liftIO $ gitGetTransitiveClosure cache mempty r <&> Set.toList -- notice "store dependencies to state" -- hashes <- readHashesFromBlock undefined @@ -90,8 +90,9 @@ export h repoHead = do els <- liftIO $ Cache.toList (hCache cache) for_ els $ \(k,vs,_) -> do updateProgress mon1 1 - for_ (Set.toList vs) $ \h -> do - stateAddDep k h + for_ (Set.toList vs) $ \ha -> do + trace $ "stateAdDep" <+> pretty k <+> pretty ha + stateAddDep k ha deps <- withDB db $ do x <- forM refs $ stateGetDeps . snd diff --git a/hbs2-git/lib/HBS2Git/State.hs b/hbs2-git/lib/HBS2Git/State.hs index b03dcf9e..0b413b9e 100644 --- a/hbs2-git/lib/HBS2Git/State.hs +++ b/hbs2-git/lib/HBS2Git/State.hs @@ -173,6 +173,7 @@ transactional action = do throwM e Right x -> do + savepointRelease sp pure x -- TODO: backlog-head-history