refactoring
authorJoey Hess <joeyh@joeyh.name>
Mon, 24 May 2021 15:38:22 +0000 (11:38 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 24 May 2021 15:38:22 +0000 (11:38 -0400)
Database/Keys.hs

index 9392b232f356183043d5ca5e2d943ac7e310c434..7f800491577494fde86fc2fa41d9b8dafc8dcf03 100644 (file)
@@ -224,19 +224,21 @@ reconcileStaged qh = do
        gitindex <- inRepo currentIndexFile
        indexcache <- fromRawFilePath <$> fromRepo gitAnnexKeysDbIndexCache
        withTSDelta (liftIO . genInodeCache gitindex) >>= \case
-               Just cur -> 
-                       liftIO (maybe Nothing readInodeCache <$> catchMaybeIO (readFile indexcache)) >>= \case
-                               Nothing -> go cur indexcache =<< getindextree
-                               Just prev -> ifM (compareInodeCaches prev cur)
-                                       ( noop
-                                       , go cur indexcache =<< getindextree
-                                       )
+               Just cur -> readindexcache indexcache >>= \case
+                       Nothing -> go cur indexcache =<< getindextree
+                       Just prev -> ifM (compareInodeCaches prev cur)
+                               ( noop
+                               , go cur indexcache =<< getindextree
+                               )
                Nothing -> noop
   where
        lastindexref = Ref "refs/annex/last-index"
 
        getindextree = inRepo writeTreeQuiet
 
+       readindexcache indexcache = liftIO $ maybe Nothing readInodeCache
+               <$> catchMaybeIO (readFile indexcache)
+
        getoldtree = fromMaybe emptyTree <$> inRepo (Git.Ref.sha lastindexref)
 
        go cur indexcache (Just newtree) = do