Make git-annex-shell call the command with its (safe) options.

This commit is contained in:
guilhem 2013-03-29 01:34:07 +01:00 committed by Joey Hess
parent f5942eba7a
commit 3bfe011867
4 changed files with 61 additions and 29 deletions

View file

@ -11,6 +11,7 @@ import Common.Annex
import Command
import CmdLine
import Annex.Content
import Annex
import Utility.Rsync
import Logs.Transfer
import Command.SendKey (fieldTransfer)
@ -19,6 +20,8 @@ import qualified Types.Key
import qualified Types.Backend
import qualified Backend
import System.Console.GetOpt
def :: [Command]
def = [noCommit $ command "recvkey" paramKey seek
SectionPlumbing "runs rsync in server mode to receive content"]
@ -40,13 +43,16 @@ start key = ifM (inAnnex key)
)
)
where
go tmp = ifM (liftIO $ rsyncServerReceive tmp)
( ifM (isJust <$> Fields.getField Fields.direct)
( directcheck tmp
, return True
go tmp = do
(opts,_,_) <- getOpt Permute rsyncSafeOptions <$>
maybe [] (split " ") <$> getField "RsyncOptions"
ifM (liftIO $ rsyncServerReceive (map Param opts) tmp)
( ifM (isJust <$> Fields.getField Fields.direct)
( directcheck tmp
, return True
)
, return False
)
, return False
)
{- If the sending repository uses direct mode, the file
- it sends could be modified as it's sending it. So check
- that the right size file was received, and that the key/value