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.
This commit is contained in:
Joey Hess 2015-08-19 14:13:19 -04:00
parent fb8fec2a7b
commit 6dad09a823
2 changed files with 8 additions and 4 deletions

View file

@ -8,6 +8,7 @@
module Remote.Helper.Chunked ( module Remote.Helper.Chunked (
ChunkSize, ChunkSize,
ChunkConfig(..), ChunkConfig(..),
noChunks,
describeChunkConfig, describeChunkConfig,
getChunkConfig, getChunkConfig,
storeChunks, storeChunks,

View file

@ -162,18 +162,21 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
(\_ -> return False) (\_ -> return False)
, removeKey = \k -> cip >>= removeKeyGen k , removeKey = \k -> cip >>= removeKeyGen k
, checkPresent = \k -> cip >>= checkPresentGen k , checkPresent = \k -> cip >>= checkPresentGen k
, cost = maybe , cost = if isencrypted
(cost baser) then cost baser + encryptedRemoteCostAdj
(const $ cost baser + encryptedRemoteCostAdj) else cost baser
(extractCipher c)
, getInfo = do , getInfo = do
l <- getInfo baser l <- getInfo baser
return $ l ++ return $ l ++
[ ("encryption", describeEncryption c) [ ("encryption", describeEncryption c)
, ("chunking", describeChunkConfig (chunkConfig cfg)) , ("chunking", describeChunkConfig (chunkConfig cfg))
] ]
, whereisKey = if noChunks (chunkConfig cfg) && not isencrypted
then whereisKey baser
else Nothing
} }
cip = cipherKey c cip = cipherKey c
isencrypted = isJust (extractCipher c)
gpgopts = getGpgEncParams encr gpgopts = getGpgEncParams encr
safely a = catchNonAsync a (\e -> warning (show e) >> return False) safely a = catchNonAsync a (\e -> warning (show e) >> return False)