On 25.03.2012 03:24, Jeff King wrote:
On Sat, Mar 24, 2012 at 09:54:16PM +0100, Ivan Todoroski wrote:
-static int rpc_service(struct rpc_state *rpc, struct discovery *heads)
+static int rpc_service(struct rpc_state *rpc, struct discovery *heads,
+ int nr_fetch, struct ref **to_fetch)
I was curious why you needed to add new arguments for this, since we
surely must be passing the information into rpc_service already (since
it has to put them on the command line). And the answer is that they are
already in the argv member of the struct rpc_state. I wonder if it would
fit the existing style of the code to pass the arguments through a
member in the rpc_state in the same way. I don't feel strongly about it,
though.
Yeah, I realized this was ugly after I sent it.... not only are new
arguments added to rpc_service(), but they seem completely arbitrary and
specific to fetch-pack. There is no reason other callers of
rpc_service() would want args in the exact same format.
On the other hand I can't reuse rpc_state.argv because that is already
passed to client.argv for start_command().
Would it be OK if I add a new memeber in rpc_state, e.g. "struct strbuf
*stdin_preamble"? If non-NULL, it would contain any data the caller of
rpc_service() wants shoved into the stdin of the sub-command before
anything else. That way the caller is free to format this data in
whatever format they need, not only in the pkt-line format needed by
fetch-pack.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html