webapp: support adding existing gcrypt special remotes from removable drives
When adding a removable drive, it's now detected if the drive contains a gcrypt special remote, and that's all handled nicely. This includes fetching the git-annex branch from the gcrypt repo in order to find out how to set up the special remote. Note that gcrypt repos that are not git-annex special remotes are not supported. It will attempt to detect such a gcrypt repo and refuse to use it. (But this is hard to do any may fail; see https://github.com/blake2-ppc/git-remote-gcrypt/issues/6) The problem with supporting regular gcrypt repos is that we don't know what the gcrypt.participants setting is intended to be for the repo. So even if we can decrypt it, if we push changes to it they might not be visible to other participants. Anyway, encrypted sneakernet (or mailnet) is now fully possible with the git-annex assistant! Assuming that the gpg key distribution is handled somehow, which the assistant doesn't yet help with. This commit was sponsored by Navishkar Rao.
This commit is contained in:
parent
c6559e5d86
commit
8062f6337f
7 changed files with 140 additions and 35 deletions
|
@ -8,15 +8,21 @@
|
|||
module Git.Remote where
|
||||
|
||||
import Common
|
||||
import Git
|
||||
import qualified Git.Command
|
||||
import qualified Git.BuildVersion
|
||||
|
||||
import Data.Char
|
||||
|
||||
type RemoteName = String
|
||||
|
||||
{- Construct a legal git remote name out of an arbitrary input string.
|
||||
-
|
||||
- There seems to be no formal definition of this in the git source,
|
||||
- just some ad-hoc checks, and some other things that fail with certian
|
||||
- types of names (like ones starting with '-').
|
||||
-}
|
||||
makeLegalName :: String -> String
|
||||
makeLegalName :: String -> RemoteName
|
||||
makeLegalName s = case filter legal $ replace "/" "_" s of
|
||||
-- it can't be empty
|
||||
[] -> "unnamed"
|
||||
|
@ -31,3 +37,14 @@ makeLegalName s = case filter legal $ replace "/" "_" s of
|
|||
legal '_' = True
|
||||
legal '.' = True
|
||||
legal c = isAlphaNum c
|
||||
|
||||
remove :: RemoteName -> Repo -> IO ()
|
||||
remove remotename = Git.Command.run
|
||||
[ Param "remote"
|
||||
-- name of this subcommand changed
|
||||
, Param $
|
||||
if Git.BuildVersion.older "1.8.0"
|
||||
then "rm"
|
||||
else "remove"
|
||||
, Param remotename
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue