Re: Clone fails on a repo with too many heads/tags
- From
- Ivan Todoroski <grnch_lists@gmx.net>
- Date
- Mar 21, 2012, 20:02 UTC
- Message-ID
- <4F6A33C5.2080909@gmx.net>
- In-Reply-To
- <20120321171423.GA13140@sigill.intra.peff.net>
On 21.03.2012 18:14, Jeff King wrote:
Show 12 quoted lines
> 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?