mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 15:10:02 +00:00
remote: give up after 256 failures to find a common object
This avoids sending our whole history bit by bit to the remote in cases where there is no common history, just to give up in the end. The number comes from the canonical implementation.
This commit is contained in:
parent
2f03050f4f
commit
a7382aa28c
@ -279,19 +279,20 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
git_oid oid;
|
git_oid oid;
|
||||||
|
|
||||||
/* No own logic, do our thing */
|
|
||||||
if ((error = git_pkt_buffer_wants(refs, count, &t->caps, &data)) < 0)
|
if ((error = git_pkt_buffer_wants(refs, count, &t->caps, &data)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if ((error = fetch_setup_walk(&walk, repo)) < 0)
|
if ((error = fetch_setup_walk(&walk, repo)) < 0)
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't support any kind of ACK extensions, so the negotiation
|
* Our support for ACK extensions is simply to parse them. On
|
||||||
* boils down to sending what we have and listening for an ACK
|
* the first ACK we will accept that as enough common
|
||||||
* every once in a while.
|
* objects. We give up if we haven't found an answer in the
|
||||||
|
* first 256 we send.
|
||||||
*/
|
*/
|
||||||
i = 0;
|
i = 0;
|
||||||
while (true) {
|
while (i < 256) {
|
||||||
error = git_revwalk_next(&oid, walk);
|
error = git_revwalk_next(&oid, walk);
|
||||||
|
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user