From: Jonathan Nieder Date: Mon, 30 Jul 2012 08:29:52 GMT Subject: Re: [RFC 1/4 v2] Implement a basic remote helper for svn in C. Message-ID: <20120730082951.GA7702@burratino> In-Reply-To: <3225988.4e4jhmQGr7@flomedio> Florian Achleitner wrote: > On Saturday 28 July 2012 02:00:31 Jonathan Nieder wrote: >> a. use --cat-blob-fd, no FIFO [...] >> * Make it conditional --- only do it (1) we are not on Windows and >> (2) the remote helper requests backflow by advertising the >> import-bidi capability. >> >> * Let the remote helper know what's going on by using >> "import-bidi" instead of "import" in the command stream to >> initiate the import. > > Generally I like your prefered solution. > I think there's one problem: > The pipe needs to be created before the fork, so that the fd can be inherited. The relevant pipe already exists at that point: the remote helper's stdin. In other words, it could work like this (just like the existing demo code, except adding a conditional based on the "capabilities" response): 0. transport-helper.c invokes the remote helper. This requires a pipe used to send commands to the remote helper (helper->in) and a pipe used to receive responses from the remote helper (helper->out) 1. transport-helper.c sends the "capabilities" command to decide what to do. The remote helper replies that it would like some feedback from fast-import. 2. transport-helper.c forks and execs git fast-import with input redirected from helper->out and the cat-blob fd redirected to helper->in 3. transport-helper.c tells the remote helper to start the import 4. wait for fast-import to exit