aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-26 13:59:27 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-26 13:59:27 -0400
commit483abf98b1949b88c3e96c987378be23f8ed869a (patch)
treebc3e75200ea69bf837ccd08a266ca4528efde09b
parent274dbabd972da62e4480bc09fa62bbcdf6f72e6f (diff)
add unlocked flag for git-annex-shell recvkey
The direct flag is also set when sending unlocked content, to support old versions of git-annex-shell. At some point, the direct flag will be removed, and only the unlocked flag will be used.
-rw-r--r--CmdLine/GitAnnexShell.hs1
-rw-r--r--CmdLine/GitAnnexShell/Fields.hs3
-rw-r--r--Command/RecvKey.hs7
-rw-r--r--Remote/Helper/Ssh.hs7
-rw-r--r--doc/git-annex-shell.mdwn2
5 files changed, 14 insertions, 6 deletions
diff --git a/CmdLine/GitAnnexShell.hs b/CmdLine/GitAnnexShell.hs
index f9678d144..09108f879 100644
--- a/CmdLine/GitAnnexShell.hs
+++ b/CmdLine/GitAnnexShell.hs
@@ -144,6 +144,7 @@ checkField :: (String, String) -> Bool
checkField (field, val)
| field == fieldName remoteUUID = fieldCheck remoteUUID val
| field == fieldName associatedFile = fieldCheck associatedFile val
+ | field == fieldName unlocked = fieldCheck unlocked val
| field == fieldName direct = fieldCheck direct val
| field == fieldName autoInit = fieldCheck autoInit val
| otherwise = False
diff --git a/CmdLine/GitAnnexShell/Fields.hs b/CmdLine/GitAnnexShell/Fields.hs
index bc26df73f..1b76fc766 100644
--- a/CmdLine/GitAnnexShell/Fields.hs
+++ b/CmdLine/GitAnnexShell/Fields.hs
@@ -35,5 +35,8 @@ associatedFile = Field "associatedfile" $ \f ->
direct :: Field
direct = Field "direct" $ \f -> f == "1"
+unlocked :: Field
+unlocked = Field "unlocked" $ \f -> f == "1"
+
autoInit :: Field
autoInit = Field "autoinit" $ \f -> f == "1"
diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs
index 988c4f90e..51bf69b1f 100644
--- a/Command/RecvKey.hs
+++ b/Command/RecvKey.hs
@@ -27,10 +27,11 @@ seek = withKeys start
start :: Key -> CommandStart
start key = fieldTransfer Download key $ \_p -> do
- -- Always verify content when a direct mode repo is sending a file,
+ -- Always verify content when a repo is sending an unlocked file,
-- as the file could change while being transferred.
- fromdirect <- isJust <$> Fields.getField Fields.direct
- let verify = if fromdirect then AlwaysVerify else DefaultVerify
+ fromunlocked <- (isJust <$> Fields.getField Fields.unlocked)
+ <||> (isJust <$> Fields.getField Fields.direct)
+ let verify = if fromunlocked then AlwaysVerify else DefaultVerify
ifM (getViaTmp verify key go)
( do
-- forcibly quit after receiving one key,
diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs
index 0442ce839..1545fa21d 100644
--- a/Remote/Helper/Ssh.hs
+++ b/Remote/Helper/Ssh.hs
@@ -126,10 +126,13 @@ rsyncHelper m params = do
{- Generates rsync parameters that ssh to the remote and asks it
- to either receive or send the key's content. -}
rsyncParamsRemote :: Bool -> Remote -> Direction -> Key -> FilePath -> AssociatedFile -> Annex [CommandParam]
-rsyncParamsRemote direct r direction key file afile = do
+rsyncParamsRemote unlocked r direction key file afile = do
u <- getUUID
let fields = (Fields.remoteUUID, fromUUID u)
- : (Fields.direct, if direct then "1" else "")
+ : (Fields.unlocked, if unlocked then "1" else "")
+ -- Send direct field for unlocked content, for backwards
+ -- compatability.
+ : (Fields.direct, if unlocked then "1" else "")
: maybe [] (\f -> [(Fields.associatedFile, f)]) afile
Just (shellcmd, shellparams) <- git_annex_shell (repo r)
(if direction == Download then "sendkey" else "recvkey")
diff --git a/doc/git-annex-shell.mdwn b/doc/git-annex-shell.mdwn
index 73517ba89..3ac9926ed 100644
--- a/doc/git-annex-shell.mdwn
+++ b/doc/git-annex-shell.mdwn
@@ -107,7 +107,7 @@ to git-annex-shell are:
on new dashed options).
Currently used fields include remoteuuid=, associatedfile=,
- direct=, and autoinit=
+ unlocked=, direct=, and autoinit=
# HOOK