diff --git a/hbs2-git3/app/Main.hs b/hbs2-git3/app/Main.hs index 39ede6b6..e7a702f9 100644 --- a/hbs2-git3/app/Main.hs +++ b/hbs2-git3/app/Main.hs @@ -895,6 +895,11 @@ theDict = do rrefs <- importedRefs liftIO $ print $ pretty rrefs + + entry $ bindMatch "reflog:imported" $ nil_ $ \syn -> lift $ connectedDo do + p <- importedCheckpoint + liftIO $ print $ pretty p + entry $ bindMatch "reflog:import" $ nil_ $ \syn -> lift $ connectedDo do updateReflogIndex @@ -902,12 +907,8 @@ theDict = do >>= orThrowUser "git directory not found" <&> ( "objects/pack") - state <- getStatePathM - sto <- getStorage - let imported = state "imported" - prev <- importedCheckpoint excl <- maybe1 prev (pure mempty) $ \p -> do diff --git a/hbs2-git3/lib/HBS2/Git3/State/Index.hs b/hbs2-git3/lib/HBS2/Git3/State/Index.hs index f325becd..c228131a 100644 --- a/hbs2-git3/lib/HBS2/Git3/State/Index.hs +++ b/hbs2-git3/lib/HBS2/Git3/State/Index.hs @@ -392,7 +392,10 @@ importedCheckpoint = do state <- getStatePathM let imported = state "imported" runMaybeT do - f <- liftIO (try @_ @IOError (readFile imported)) >>= toMPlus + f <- liftIO (try @_ @IOError (readFile imported <&> headMay . lines)) + >>= toMPlus + >>= toMPlus + toMPlus (fromStringMay @HashRef f) {- HLINT ignore "Functor law"-} @@ -439,5 +442,5 @@ updateImportedCheckpoint cp = do state <- getStatePathM let imported = state "imported" liftIO $ UIO.withBinaryFileAtomic imported WriteMode $ \fh -> do - hPrint fh (show $ pretty cp) + hPrint fh (pretty cp)