Re: Re: [PATCH v5] builtin/clone.c: add --reject-shallow option
- From
- lilinchao@oschina.cn <lilinchao@oschina.cn>
- Date
- Mar 4, 2021, 06:26 UTC
- Message-ID
- <84f2a4d67cb211eb83f10024e87935e7@oschina.cn>
- In-Reply-To
- <nycvar.QRO.7.76.6.2103012338100.57@tvgsbejvaqbjf.bet>
Show 26 quoted lines
>Hi,
>
>On Mon, 1 Mar 2021, lilinchao@oschina.cn wrote:
>
>> >@@ -1440,6 +1444,8 @@ static void receive_shallow_info(struct fetch_pack_args *args,
>> > * shallow. In v0, remote refs that reach these objects are
>> > * rejected (unless --update-shallow is set); do the same.
>> > */
>> >+ if (args->remote_shallow)
>> >+ die("source repository is shallow, reject to clone.");
>>
>> I just found that Johannes Schindelin wrote a document 14 year ago
>> in Documentation/technical/shallow.txt:
>>
>> "There are some unfinished ends of the whole shallow business:
>>
>> A special handling of a shallow upstream is needed. At some stage,
>> upload-pack has to check if it sends a shallow commit, and it should
>> send that information early (or fail, if the client does not support
>> shallow repositories). There is no support at all for this in this patch
>> series."
>
>Oh wow, what a blast from the past.
>
>I do agree that your patch is an improvement over the current situation.
> Thanks. Glad to hear the voice from you, hope I can get some suggestions from you too, especially on the transport part.
Show 12 quoted lines
>Thanks,
>Johannes
>
>> It seems that my patch can sovle his worry in some degree,
>> and maybe we could warn client in fetch-pack stage, if we don't
>> choose to reject shallow cloning.
>>
>> if (args->remote_shallow)
>> die("source repository is shallow, reject to clone.");
>> else
>> warning("remote source repository is shallow.");
>>