diff options
author | Joey Hess <joey@kitenet.net> | 2011-04-09 14:26:32 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-04-09 14:26:32 -0400 |
commit | 8ad901a647a9c7cf179dc2dd73d121adc43a28fb (patch) | |
tree | f62b1ff88490f84e34cda0b4cd419be4261010fb /Remote/Git.hs | |
parent | 1e7ad2ee7c63c02c8f6b9df465576c8245bba8a6 (diff) |
refactor
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r-- | Remote/Git.hs | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index c315d457d..7724df79a 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -5,10 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module Remote.Git ( - remote, - onRemote -) where +module Remote.Git (remote) where import Control.Exception.Extensible import Control.Monad.State (liftIO) @@ -194,34 +191,3 @@ rsyncParams r sending key file = do -- goes, so the source/dest parameter can be a dummy value, -- that just enables remote rsync mode. dummy = Param ":" - -{- Uses a supplied function to run a git-annex-shell command on a remote. - - - - Or, if the remote does not support running remote commands, returns - - a specified error value. -} -onRemote - :: Git.Repo - -> (FilePath -> [CommandParam] -> IO a, a) - -> String - -> [CommandParam] - -> Annex a -onRemote r (with, errorval) command params = do - s <- git_annex_shell r command params - case s of - Just (c, ps) -> liftIO $ with c ps - Nothing -> return errorval - -{- Generates parameters to run a git-annex-shell command on a remote. -} -git_annex_shell :: Git.Repo -> String -> [CommandParam] -> Annex (Maybe (FilePath, [CommandParam])) -git_annex_shell r command params - | not $ Git.repoIsUrl r = return $ Just (shellcmd, shellopts) - | Git.repoIsSsh r = do - sshparams <- sshToRepo r [Param sshcmd] - return $ Just ("ssh", sshparams) - | otherwise = return Nothing - where - dir = Git.workTree r - shellcmd = "git-annex-shell" - shellopts = (Param command):(File dir):params - sshcmd = shellcmd ++ " " ++ - unwords (map shellEscape $ toCommand shellopts) |