From: Joey Hess Date: Mon, 7 Nov 2016 16:07:36 +0000 (-0400) Subject: reinject --known: Avoid second, unncessary checksum of file. X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~287^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5afc2eaa54649ee6735163f5a5a19b1032630078;p=git-annex.git reinject --known: Avoid second, unncessary checksum of file. --- diff --git a/CHANGELOG b/CHANGELOG index cfba35d16e..d4192db482 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ git-annex (6.20161032) UNRELEASED; urgency=medium * S3: Support the special case endpoint needed for the cn-north-1 region. * Webapp: Don't list the Frankfurt region, as this (and some other new regions) need V4 authorization which the aws library does not yet use. + * reinject --known: Avoid second, unncessary checksum of file. -- Joey Hess Tue, 01 Nov 2016 14:02:06 -0400 diff --git a/Command/Reinject.hs b/Command/Reinject.hs index ce18c7cb6b..fa2459e22d 100644 --- a/Command/Reinject.hs +++ b/Command/Reinject.hs @@ -45,7 +45,7 @@ startSrcDest (src:dest:[]) | otherwise = notAnnexed src $ do showStart "reinject" dest next $ ifAnnexed dest - (perform src) + (\key -> perform src key (verifyKeyContent DefaultVerify UnVerified key src)) stop startSrcDest _ = error "specify a src file and a dest file" @@ -56,7 +56,7 @@ startKnown src = notAnnexed src $ do case mkb of Nothing -> error "Failed to generate key" Just (key, _) -> ifM (isKnownKey key) - ( next $ perform src key + ( next $ perform src key (return True) , do warning "Not known content; skipping" next $ next $ return True @@ -65,14 +65,14 @@ startKnown src = notAnnexed src $ do notAnnexed :: FilePath -> CommandStart -> CommandStart notAnnexed src = ifAnnexed src (error $ "cannot used annexed file as src: " ++ src) -perform :: FilePath -> Key -> CommandPerform -perform src key = ifM move +perform :: FilePath -> Key -> Annex Bool -> CommandPerform +perform src key verify = ifM move ( next $ cleanup key , error "failed" ) where move = checkDiskSpaceToGet key False $ - ifM (verifyKeyContent DefaultVerify UnVerified key src) + ifM verify ( do moveAnnex key src return True diff --git a/doc/forum/Timeline_of_git_reinject__63__/comment_1_e88d612590d3cd0c2ea824c1e8a38678._comment b/doc/forum/Timeline_of_git_reinject__63__/comment_1_e88d612590d3cd0c2ea824c1e8a38678._comment new file mode 100644 index 0000000000..50d9aa68fb --- /dev/null +++ b/doc/forum/Timeline_of_git_reinject__63__/comment_1_e88d612590d3cd0c2ea824c1e8a38678._comment @@ -0,0 +1,19 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-11-07T16:02:28Z" + content=""" +What turns out to have been going on here is the file was first checksummed +silently to get the key and see if it is --known, +and then checksummed a second time (with the message displayed) as part of +the reinject process. + +So, the second checksum is not needed in --known mode and I've made it not +be done. + +It might be that the "(checksum)" message should be displayed during the +intial checksum of the file. git-annex used to always say when it +checksummed, but [[!commit 64160a96795d03ee791faa4757057200934687bc]] got +rid of that in most cases. I guess that "reinject bigfile <13 minute wait> ok" +is acceptable output though. +"""]]