summaryrefslogtreecommitdiff
path: root/Remote/GCrypt.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-24 17:51:12 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-24 17:51:12 -0400
commit2270913743982ab33c68d17c8ed68326e1711f95 (patch)
treedbc8b7ad18e705345cb27daf051e8ff131a5031e /Remote/GCrypt.hs
parente079835fdd71231f680b86fac4f283d8d1afa2e0 (diff)
add back lost check that git-annex-shell supports gcrypt
Diffstat (limited to 'Remote/GCrypt.hs')
-rw-r--r--Remote/GCrypt.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs
index e5e7e8d48..5e8102652 100644
--- a/Remote/GCrypt.hs
+++ b/Remote/GCrypt.hs
@@ -209,7 +209,14 @@ gCryptSetup mu c = go $ M.lookup "gitrepo" c
-}
setupRepo :: Git.GCrypt.GCryptId -> Git.Repo -> Annex AccessMethod
setupRepo gcryptid r
- | Git.repoIsUrl r = rsyncsetup
+ | Git.repoIsUrl r = do
+ accessmethod <- rsyncsetup
+ case accessmethod of
+ AccessDirect -> return AccessDirect
+ AccessShell -> ifM usablegitannexshell
+ ( return AccessShell
+ , return AccessDirect
+ )
| Git.repoIsLocalUnknown r = localsetup =<< liftIO (Git.Config.read r)
| otherwise = localsetup r
where
@@ -245,6 +252,11 @@ setupRepo gcryptid r
error "Failed to connect to remote to set it up."
return accessmethod
+ {- Check if git-annex shell is installed, and is a new enough
+ - version to work in a gcrypt repo. -}
+ usablegitannexshell = either (const False) (const True)
+ <$> Ssh.onRemote r (Git.Config.fromPipe r, Left undefined) "configlist" [] []
+
shellOrRsync :: Remote -> Annex a -> Annex a -> Annex a
shellOrRsync r ashell arsync = case method of
AccessShell -> ashell