refactor
This commit is contained in:
parent
341d09adc2
commit
5fce2c013d
1 changed files with 15 additions and 12 deletions
|
@ -66,11 +66,9 @@ makeXMPPGitRemote buddyname jid u = do
|
||||||
- git receive-pack <--> xmppReceivePack <---------------> xmpp
|
- git receive-pack <--> xmppReceivePack <---------------> xmpp
|
||||||
-
|
-
|
||||||
- The pipe between git-annex xmppgit and us is set up and communicated
|
- The pipe between git-annex xmppgit and us is set up and communicated
|
||||||
- using two file descriptors, GIT_ANNEX_XMPPGIT_IN and
|
- using two environment variables, relayIn and relayOut, that are set
|
||||||
- GIT_ANNEX_XMPPGIT_OUT. It simply connects those up to its stdin
|
- to the file descriptors to use. Another, relayControl, is used to
|
||||||
- and stdout, respectively, which are in turn connected to "git-push".
|
- propigate the exit status of git receive-pack.
|
||||||
- There is also a GIT_ANNEX_XMPPGIT_CONTROL descriptor, to which an
|
|
||||||
- exit status is sent for xmppgit to propigate.
|
|
||||||
-
|
-
|
||||||
- We listen at the other end of the pipe and relay to and from XMPP.
|
- We listen at the other end of the pipe and relay to and from XMPP.
|
||||||
-}
|
-}
|
||||||
|
@ -141,16 +139,21 @@ xmppPush cid remote refs = runPush (SendPushRunning cid) handleDeferred $ do
|
||||||
]
|
]
|
||||||
modifyFileMode wrapper $ addModes executeModes
|
modifyFileMode wrapper $ addModes executeModes
|
||||||
|
|
||||||
relayIn :: String
|
type EnvVar = String
|
||||||
relayIn = "GIT_ANNEX_XMPPGIT_IN"
|
|
||||||
|
|
||||||
relayOut :: String
|
envVar :: String -> EnvVar
|
||||||
relayOut = "GIT_ANNEX_XMPPGIT_OUT"
|
envVar s = "GIT_ANNEX_XMPPGIT_" ++ s
|
||||||
|
|
||||||
relayControl :: String
|
relayIn :: EnvVar
|
||||||
relayControl = "GIT_ANNEX_XMPPGIT_CONTROL"
|
relayIn = envVar "IN"
|
||||||
|
|
||||||
relayHandle :: String -> IO Handle
|
relayOut :: EnvVar
|
||||||
|
relayOut = envVar "OUT"
|
||||||
|
|
||||||
|
relayControl :: EnvVar
|
||||||
|
relayControl = envVar "CONTROL"
|
||||||
|
|
||||||
|
relayHandle :: EnvVar -> IO Handle
|
||||||
relayHandle var = do
|
relayHandle var = do
|
||||||
v <- getEnv var
|
v <- getEnv var
|
||||||
case readish =<< v of
|
case readish =<< v of
|
||||||
|
|
Loading…
Add table
Reference in a new issue