reinject --known: Avoid second, unncessary checksum of file.
authorJoey Hess <joeyh@joeyh.name>
Mon, 7 Nov 2016 16:07:36 +0000 (12:07 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 7 Nov 2016 16:07:36 +0000 (12:07 -0400)
CHANGELOG
Command/Reinject.hs
doc/forum/Timeline_of_git_reinject__63__/comment_1_e88d612590d3cd0c2ea824c1e8a38678._comment [new file with mode: 0644]

index cfba35d16e1f4fb5d75a50401441ec7477d9ddc3..d4192db482fd6e8be7021fb8d121a3a5c2b7fda1 100644 (file)
--- 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 <id@joeyh.name>  Tue, 01 Nov 2016 14:02:06 -0400
 
index ce18c7cb6b7592c822de9fc4071ee61955867c23..fa2459e22d6c5b3e834de8954efcda10cb7c3b3c 100644 (file)
@@ -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 (file)
index 0000000..50d9aa6
--- /dev/null
@@ -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.
+"""]]