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.
This commit is contained in:
parent
f324ad24c1
commit
f776ac0a11
5 changed files with 14 additions and 6 deletions
|
@ -144,6 +144,7 @@ checkField :: (String, String) -> Bool
|
||||||
checkField (field, val)
|
checkField (field, val)
|
||||||
| field == fieldName remoteUUID = fieldCheck remoteUUID val
|
| field == fieldName remoteUUID = fieldCheck remoteUUID val
|
||||||
| field == fieldName associatedFile = fieldCheck associatedFile val
|
| field == fieldName associatedFile = fieldCheck associatedFile val
|
||||||
|
| field == fieldName unlocked = fieldCheck unlocked val
|
||||||
| field == fieldName direct = fieldCheck direct val
|
| field == fieldName direct = fieldCheck direct val
|
||||||
| field == fieldName autoInit = fieldCheck autoInit val
|
| field == fieldName autoInit = fieldCheck autoInit val
|
||||||
| otherwise = False
|
| otherwise = False
|
||||||
|
|
|
@ -35,5 +35,8 @@ associatedFile = Field "associatedfile" $ \f ->
|
||||||
direct :: Field
|
direct :: Field
|
||||||
direct = Field "direct" $ \f -> f == "1"
|
direct = Field "direct" $ \f -> f == "1"
|
||||||
|
|
||||||
|
unlocked :: Field
|
||||||
|
unlocked = Field "unlocked" $ \f -> f == "1"
|
||||||
|
|
||||||
autoInit :: Field
|
autoInit :: Field
|
||||||
autoInit = Field "autoinit" $ \f -> f == "1"
|
autoInit = Field "autoinit" $ \f -> f == "1"
|
||||||
|
|
|
@ -27,10 +27,11 @@ seek = withKeys start
|
||||||
|
|
||||||
start :: Key -> CommandStart
|
start :: Key -> CommandStart
|
||||||
start key = fieldTransfer Download key $ \_p -> do
|
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.
|
-- as the file could change while being transferred.
|
||||||
fromdirect <- isJust <$> Fields.getField Fields.direct
|
fromunlocked <- (isJust <$> Fields.getField Fields.unlocked)
|
||||||
let verify = if fromdirect then AlwaysVerify else DefaultVerify
|
<||> (isJust <$> Fields.getField Fields.direct)
|
||||||
|
let verify = if fromunlocked then AlwaysVerify else DefaultVerify
|
||||||
ifM (getViaTmp verify key go)
|
ifM (getViaTmp verify key go)
|
||||||
( do
|
( do
|
||||||
-- forcibly quit after receiving one key,
|
-- forcibly quit after receiving one key,
|
||||||
|
|
|
@ -126,10 +126,13 @@ rsyncHelper m params = do
|
||||||
{- Generates rsync parameters that ssh to the remote and asks it
|
{- Generates rsync parameters that ssh to the remote and asks it
|
||||||
- to either receive or send the key's content. -}
|
- to either receive or send the key's content. -}
|
||||||
rsyncParamsRemote :: Bool -> Remote -> Direction -> Key -> FilePath -> AssociatedFile -> Annex [CommandParam]
|
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
|
u <- getUUID
|
||||||
let fields = (Fields.remoteUUID, fromUUID u)
|
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
|
: maybe [] (\f -> [(Fields.associatedFile, f)]) afile
|
||||||
Just (shellcmd, shellparams) <- git_annex_shell (repo r)
|
Just (shellcmd, shellparams) <- git_annex_shell (repo r)
|
||||||
(if direction == Download then "sendkey" else "recvkey")
|
(if direction == Download then "sendkey" else "recvkey")
|
||||||
|
|
|
@ -107,7 +107,7 @@ to git-annex-shell are:
|
||||||
on new dashed options).
|
on new dashed options).
|
||||||
|
|
||||||
Currently used fields include remoteuuid=, associatedfile=,
|
Currently used fields include remoteuuid=, associatedfile=,
|
||||||
direct=, and autoinit=
|
unlocked=, direct=, and autoinit=
|
||||||
|
|
||||||
# HOOK
|
# HOOK
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue