diff --git a/Annex/Content.hs b/Annex/Content.hs index a6ef6a73cd..5f7b2f39e8 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -491,28 +491,26 @@ sendAnnex key rollback sendobject = go =<< prepSendAnnex' key -} prepSendAnnex :: Key -> Annex (Maybe (FilePath, Annex Bool)) prepSendAnnex key = withObjectLoc key $ \f -> do + let retval c = return $ Just (fromRawFilePath f, sameInodeCache f c) cache <- Database.Keys.getInodeCaches key - cache' <- if null cache + if null cache -- Since no inode cache is in the database, this -- object is not currently unlocked. But that could -- change while the transfer is in progress, so -- generate an inode cache for the starting -- content. - then maybeToList <$> - withTSDelta (liftIO . genInodeCache f) + then maybe (return Nothing) (retval . (:[])) + =<< withTSDelta (liftIO . genInodeCache f) -- Verify that the object is not modified. Usually this -- only has to check the inode cache, but if the cache -- is somehow stale, it will fall back to verifying its -- content. else withTSDelta (liftIO . genInodeCache f) >>= \case Just fc -> ifM (isUnmodified' key f fc cache) - ( return (fc:cache) - , return [] + ( retval (fc:cache) + , return Nothing ) - Nothing -> return [] - return $ if null cache' - then Nothing - else Just (fromRawFilePath f, sameInodeCache f cache') + Nothing -> return Nothing prepSendAnnex' :: Key -> Annex (Maybe (FilePath, Annex (Maybe String))) prepSendAnnex' key = prepSendAnnex key >>= \case diff --git a/Annex/Content/Presence/LowLevel.hs b/Annex/Content/Presence/LowLevel.hs index 5d6bb42420..1191500dfc 100644 --- a/Annex/Content/Presence/LowLevel.hs +++ b/Annex/Content/Presence/LowLevel.hs @@ -14,7 +14,8 @@ import Annex.InodeSentinal import Utility.InodeCache isUnmodifiedLowLevel :: (Key -> [InodeCache] -> Annex ()) -> Key -> RawFilePath -> InodeCache -> [InodeCache] -> Annex Bool -isUnmodifiedLowLevel addinodecaches key f fc ic = isUnmodifiedCheapLowLevel fc ic <||> expensivecheck +isUnmodifiedLowLevel addinodecaches key f fc ic = + isUnmodifiedCheapLowLevel fc ic <||> expensivecheck where expensivecheck = ifM (verifyKeyContent RetrievalAllKeysSecure AlwaysVerify UnVerified key f) ( do