From 13423f337c7fb7814f95d775e65d12e16875c091 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 24 May 2021 11:38:22 -0400 Subject: [PATCH] refactoring --- Database/Keys.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Database/Keys.hs b/Database/Keys.hs index 9392b232f3..7f80049157 100644 --- a/Database/Keys.hs +++ b/Database/Keys.hs @@ -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 -- 2.30.2