Subject: Re: Clone fails on a repo with too many heads/tags

From: Ivan Todoroski <[email-masked]>
Date: Wed, 21 Mar 2012 12:05:20 +0100

On 19.03.2012 03:44, Jeff King wrote:
> On Mon, Mar 19, 2012 at 08:30:38AM +0700, Nguyen Thai Ngoc Duy wrote:
> 
>> On Mon, Mar 19, 2012 at 2:07 AM, Jeff King <[email-masked]> wrote:
>>> I don't think that will work, as stateless-rpc fetch-pack already uses
>>> stdin to receive the list of advertised refs from the remote. Nor would
>>> you want to have multiple invocations of fetch-pack, since that would
>>> mean multiple http requests and multiple pack responses (which could not
>>> delta between themselves).
>> remote-curl functions as middle man between http client and
>> fetch-pack. Can we just send ref list over fetch-pack.stdin first,
>> followed by maybe empty line, then normal stuff that remote-curl feeds
>> fetch-pack?
> 
> Yes, I think that would work. You'd just have to take care to pass the
> residual buffer (i.e., what is left in your input buffer after you
> notice that reading the list of wanted refs is finished) along to
> the git-protocol code.  So it would require a little refactoring of
> get_remote_heads, I think.

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 way we can read() the exact number of bytes needed for the refs 
from the fd and there would be no need to refactor get_remote_heads() to 
pass a residual buffer, it could just continue reading straight from the 
same fd.