From c4e9c34f3022ab6f4bcc0ad6f860bbd68fe97e50 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Aug 2015 14:13:19 -0400 Subject: disable whereisKey for encrypted or chunked remotes This only makes sense for public repos, that are not chunked, so that there's a 1:1 from Key in the git-annex repo to file on the remote. Rather than making every remote implementation deal with that, just disable whereisKey when it doesn't make sense. --- Remote/Helper/Chunked.hs | 1 + Remote/Helper/Special.hs | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Remote/Helper') diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs index 23ed3dbf8..7692abeb5 100644 --- a/Remote/Helper/Chunked.hs +++ b/Remote/Helper/Chunked.hs @@ -8,6 +8,7 @@ module Remote.Helper.Chunked ( ChunkSize, ChunkConfig(..), + noChunks, describeChunkConfig, getChunkConfig, storeChunks, diff --git a/Remote/Helper/Special.hs b/Remote/Helper/Special.hs index 60bf123a5..42827e5f7 100644 --- a/Remote/Helper/Special.hs +++ b/Remote/Helper/Special.hs @@ -162,18 +162,21 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp (\_ -> return False) , removeKey = \k -> cip >>= removeKeyGen k , checkPresent = \k -> cip >>= checkPresentGen k - , cost = maybe - (cost baser) - (const $ cost baser + encryptedRemoteCostAdj) - (extractCipher c) + , cost = if isencrypted + then cost baser + encryptedRemoteCostAdj + else cost baser , getInfo = do l <- getInfo baser return $ l ++ [ ("encryption", describeEncryption c) , ("chunking", describeChunkConfig (chunkConfig cfg)) ] + , whereisKey = if noChunks (chunkConfig cfg) && not isencrypted + then whereisKey baser + else Nothing } cip = cipherKey c + isencrypted = isJust (extractCipher c) gpgopts = getGpgEncParams encr safely a = catchNonAsync a (\e -> warning (show e) >> return False) -- cgit v1.2.3