From d8331995cd692d6b81895114e23dc7b1939fc6d1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 9 Nov 2012 12:51:54 -0400 Subject: use xmpp::user@host for xmpp remotes Inject the required git-remote-xmpp into PATH when running xmpp git push. Rest of the time it will not be in PATH, and git won't be able to talk to xmpp remotes. --- Command/XMPPGit.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Command/XMPPGit.hs') diff --git a/Command/XMPPGit.hs b/Command/XMPPGit.hs index ca7058c12..9df4f5d66 100644 --- a/Command/XMPPGit.hs +++ b/Command/XMPPGit.hs @@ -20,5 +20,22 @@ seek = [withWords start] start :: [String] -> CommandStart start _ = do + liftIO gitRemoteHelper liftIO xmppGitRelay stop + +{- 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 "" -- cgit v1.2.3