From: Joey Hess Date: Wed, 24 Jul 2024 14:28:48 +0000 (-0400) Subject: fix meter display on resume X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~21^2~228^2~62 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0594338a78897fb0cd56d9556794b056174780ab;p=git-annex.git fix meter display on resume It still needs to be offset, otherwise on resume from 80% it will display 1%..20%. Seems that this bug must have affected P2P.Annex as well where it runs this code, but apparently it didn't affect it in a very user-visible way. Maybe the transfer log file was updated incorrectly? --- diff --git a/Annex/Verify.hs b/Annex/Verify.hs index c7da82f225..26ebb1d917 100644 --- a/Annex/Verify.hs +++ b/Annex/Verify.hs @@ -224,28 +224,29 @@ writeVerifyChunk Nothing h c = S.hPut h c {- Given a file handle that is open for reading (and likely also for writing), - and an offset, feeds the current content of the file up to the offset to - - the IncrementalVerifier. Leaves the file seeked to the offset. - - Also updates the meter to the offset. -} + - the IncrementalVerifier. Leaves the file seeked to the offset. + - Returns the meter with the offset applied. -} resumeVerifyFromOffset :: Integer -> Maybe IncrementalVerifier -> MeterUpdate -> Handle -> IO MeterUpdate -resumeVerifyFromOffset o incrementalverifier p h +resumeVerifyFromOffset o incrementalverifier meterupdate h | o /= 0 = do p' <- case incrementalverifier of Just iv -> do go iv o - return p - _ -> return $ offsetMeterUpdate p (toBytesProcessed o) + return offsetmeterupdate + _ -> return offsetmeterupdate -- Make sure the handle is seeked to the offset. -- (Reading the file probably left it there -- when that was done, but let's be sure.) hSeek h AbsoluteSeek o return p' - | otherwise = return p + | otherwise = return meterupdate where + offsetmeterupdate = offsetMeterUpdate meterupdate (toBytesProcessed o) go iv n | n == 0 = return () | otherwise = do