diff --git a/fixme-new/lib/Fixme/Scan/Git/Local.hs b/fixme-new/lib/Fixme/Scan/Git/Local.hs index b49d4c4f..0afa1f8a 100644 --- a/fixme-new/lib/Fixme/Scan/Git/Local.hs +++ b/fixme-new/lib/Fixme/Scan/Git/Local.hs @@ -183,15 +183,20 @@ scanGitLogLocal refMask play = do withState $ transactional do flip runContT pure do - for_ logz $ \(commitHash, h) -> do - warn $ blue "SCAN BLOB" <+> pretty h - tmp <- ContT $ bracket (liftIO (emptySystemTempFile "fixme-log")) rm - blob <- lift $ lift $ gitCatBlob h - liftIO (LBS8.writeFile tmp blob) - sto <- ContT $ bracket (compactStorageOpen @HbSync readonly tmp) compactStorageClose - lift $ lift $ loadAllEntriesFromLog sto >>= play - lift $ insertProcessed (ViaSerialise commitHash) + for_ logz $ \(commitHash, h) -> callCC \shit -> do + warn $ blue "SCAN BLOB" <+> pretty h + tmp <- ContT $ bracket (liftIO (emptySystemTempFile "fixme-log")) rm + blob <- lift $ lift $ gitCatBlob h + liftIO (LBS8.writeFile tmp blob) + esto <- lift $ try @_ @CompactStorageOpenError $ compactStorageOpen @HbSync readonly tmp + either (const $ warn $ "skip malformed/unknown log" <+> pretty h) (const none) esto + sto <- either (const $ shit ()) pure esto + + lift $ lift $ loadAllEntriesFromLog sto >>= play + lift $ insertProcessed (ViaSerialise commitHash) + + compactStorageClose sto scanGitLocal :: FixmePerks m => [ScanGitArgs] diff --git a/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs b/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs index a6a1ed83..3bcd6137 100644 --- a/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs +++ b/hbs2-storage-simple/lib/HBS2/Storage/Compact.hs @@ -3,6 +3,7 @@ {-# Language UndecidableInstances #-} module HBS2.Storage.Compact ( Storage(..) + , CompactStorageOpenError(..) , CompactStorage , CompactStorageOpenOpt(..) , readonly