2012-11-06 04:52:35 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.XMPPGit where
|
|
|
|
|
|
|
|
import Common.Annex
|
|
|
|
import Command
|
|
|
|
import Assistant.XMPP.Git
|
|
|
|
|
|
|
|
def :: [Command]
|
|
|
|
def = [noCommit $ noRepo xmppGitRelay $ dontCheck repoExists $
|
2013-03-24 22:28:21 +00:00
|
|
|
command "xmppgit" paramNothing seek
|
|
|
|
SectionPlumbing "git to XMPP relay"]
|
2012-11-06 04:52:35 +00:00
|
|
|
|
|
|
|
seek :: [CommandSeek]
|
|
|
|
seek = [withWords start]
|
|
|
|
|
|
|
|
start :: [String] -> CommandStart
|
|
|
|
start _ = do
|
2012-11-09 16:51:54 +00:00
|
|
|
liftIO gitRemoteHelper
|
2012-11-06 04:52:35 +00:00
|
|
|
liftIO xmppGitRelay
|
|
|
|
stop
|
2012-11-09 16:51:54 +00:00
|
|
|
|
|
|
|
{- A basic implementation of the git-remote-helpers protocol. -}
|
|
|
|
gitRemoteHelper :: IO ()
|
|
|
|
gitRemoteHelper = do
|
|
|
|
expect "capabilities"
|
|
|
|
respond ["connect"]
|
|
|
|
expect "connect git-receive-pack"
|
|
|
|
respond []
|
|
|
|
where
|
|
|
|
expect s = do
|
|
|
|
cmd <- getLine
|
|
|
|
unless (cmd == s) $
|
|
|
|
error $ "git-remote-helpers protocol error: expected: " ++ s ++ ", but got: " ++ cmd
|
|
|
|
respond l = do
|
|
|
|
mapM_ putStrLn l
|
|
|
|
putStrLn ""
|
2012-11-09 18:33:34 +00:00
|
|
|
hFlush stdout
|