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:
parent
05684bdd6c
commit
8844372c23
1 changed files with 3 additions and 9 deletions
|
@ -22,7 +22,6 @@ import Types.Backend
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
import Utility.Hash
|
import Utility.Hash
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
import qualified Utility.RawFilePath as R
|
|
||||||
|
|
||||||
import qualified Data.ByteString as S
|
import qualified Data.ByteString as S
|
||||||
import qualified Data.ByteString.Short as S (toShort, fromShort)
|
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 -> RawFilePath -> Annex Bool
|
||||||
checkKeyChecksum hash key file = catchIOErrorType HardwareFault hwfault $ do
|
checkKeyChecksum hash key file = catchIOErrorType HardwareFault hwfault $ do
|
||||||
fast <- Annex.getRead Annex.fast
|
showAction (UnquotedString descChecksum)
|
||||||
exists <- liftIO $ R.doesPathExist file
|
sameCheckSum key
|
||||||
case (exists, fast) of
|
<$> hashFile hash file nullMeterUpdate
|
||||||
(True, False) -> do
|
|
||||||
showAction (UnquotedString descChecksum)
|
|
||||||
sameCheckSum key
|
|
||||||
<$> hashFile hash file nullMeterUpdate
|
|
||||||
_ -> return True
|
|
||||||
where
|
where
|
||||||
hwfault e = do
|
hwfault e = do
|
||||||
warning $ UnquotedString $ "hardware fault: " ++ show e
|
warning $ UnquotedString $ "hardware fault: " ++ show e
|
||||||
|
|
Loading…
Reference in a new issue