summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-08-19 14:13:19 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-08-19 14:16:01 -0400
commitc4e9c34f3022ab6f4bcc0ad6f860bbd68fe97e50 (patch)
tree117963ca764616b5f4738a48866626d876badb1d
parentb742823f8ffbadf1a23b7ea393201b5811cb850e (diff)
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.
-rw-r--r--Remote/Helper/Chunked.hs1
-rw-r--r--Remote/Helper/Special.hs11
2 files changed, 8 insertions, 4 deletions
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)