On 21.03.2012 18:14, Jeff King wrote:
On Wed, Mar 21, 2012 at 07:28:24AM -0700, Shawn O. Pearce wrote:
Would it be OK for fetch-pack.c to use the packetized format (pkt-line.h)
for reading the list of refs from stdin?
This is probably the easiest way to implement the sneak-into-stdin
patch. Use a pkt-line for each argument that should have been in the
argv array from the command line, and a flush pkt to terminate the
list.
Something in me feels slightly uncomfortable with that, just because
simple newline-delimited formats make it easy for people to hack on the
tool and feed input from unexpected sources.
I understand what you mean. How about this:
If both --stdin and --stateless-rpc are specified to fetch-pack, it will
use pkt-line to read the refs from stdin before handing off stdin to
get_remote_heads().
However, if only --stdin is specified, it will read refs from stdin in a
script-friendly newline delimited format, one ref per line. This is okay
because when --stateless-rpc is not specified get_remote_heads() reads
from an fd different from stdin so there is no issue with residual
buffers in this case.
This way you preserve scriptability for any other callers who don't use
--stateless-rpc.
How does this sound?
--
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