remove doesPathExist check in checkKeyCheckSum

Before commit c565340adc,
it was statting the file in order to get its size, which was needed to
use an external hasher. In that commit since it no longer needed the
stat, I made it check doesPathExist since the old code implicitly
checked if the file existed. But that is not necessary, this should only
be ever called on files that exist.
This commit is contained in:
Joey Hess 2024-05-12 21:27:03 -04:00
parent 05684bdd6c
commit 8844372c23
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -22,7 +22,6 @@ import Types.Backend
import Types.KeySource
import Utility.Hash
import Utility.Metered
import qualified Utility.RawFilePath as R
import qualified Data.ByteString as S
import qualified Data.ByteString.Short as S (toShort, fromShort)
@ -125,14 +124,9 @@ keyValueE hash source meterupdate =
checkKeyChecksum :: Hash -> Key -> RawFilePath -> Annex Bool
checkKeyChecksum hash key file = catchIOErrorType HardwareFault hwfault $ do
fast <- Annex.getRead Annex.fast
exists <- liftIO $ R.doesPathExist file
case (exists, fast) of
(True, False) -> do
showAction (UnquotedString descChecksum)
sameCheckSum key
<$> hashFile hash file nullMeterUpdate
_ -> return True
where
hwfault e = do
warning $ UnquotedString $ "hardware fault: " ++ show e