Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-10-26 18:52:54 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-11-02 01:47:06 +0400
commita7382aa28c8a24a4f718eb01574d744330f7a5a9 (patch)
tree6bc99d5510c1825c478d1f3dfb91955dcbf2dab5 /src/transports
parent2f03050f4fc50746faef46be498aa0af9697fee2 (diff)
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.
Diffstat (limited to 'src/transports')
-rw-r--r--src/transports/smart_protocol.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 651901b1b..5d7b9bcba 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -279,19 +279,20 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
unsigned int i;
git_oid oid;
- /* No own logic, do our thing */
if ((error = git_pkt_buffer_wants(refs, count, &t->caps, &data)) < 0)
return error;
if ((error = fetch_setup_walk(&walk, repo)) < 0)
goto on_error;
+
/*
- * We don't support any kind of ACK extensions, so the negotiation
- * boils down to sending what we have and listening for an ACK
- * every once in a while.
+ * Our support for ACK extensions is simply to parse them. On
+ * the first ACK we will accept that as enough common
+ * objects. We give up if we haven't found an answer in the
+ * first 256 we send.
*/
i = 0;
- while (true) {
+ while (i < 256) {
error = git_revwalk_next(&oid, walk);
if (error < 0) {