refactoring

This commit is contained in:
Joey Hess 2021-05-24 11:38:22 -04:00
parent efae085272
commit 13423f337c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

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