summaryrefslogtreecommitdiff
path: root/builtin/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-03-21 04:52:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-03-21 04:53:25 (GMT)
commit6afca450c3f2f05385900a7b8d3a0d47286f983f (patch)
treea090f14d020f7835668d94801f20f12315c8986e /builtin/fetch-pack.c
parentc12f5917e4f528b056a8b9ca625397aee97ae1e4 (diff)
downloadgit-6afca450c3f2f05385900a7b8d3a0d47286f983f.zip
git-6afca450c3f2f05385900a7b8d3a0d47286f983f.tar.gz
git-6afca450c3f2f05385900a7b8d3a0d47286f983f.tar.bz2
fetch-pack: progressively use larger handshake windows
The client has to dig the history deeper when more recent parts of its history do not have any overlap with the server it is fetching from. Make the handshake window exponentially larger as we dig deeper, with a reasonable upper cap. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Shawn Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin/fetch-pack.c')
-rw-r--r--builtin/fetch-pack.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 1abe624..b4f34a2 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -219,10 +219,15 @@ static void send_request(int fd, struct strbuf *buf)
}
#define INITIAL_FLUSH 32
+#define LARGE_FLUSH 1024
static int next_flush(int count)
{
- return INITIAL_FLUSH + count;
+ if (count < LARGE_FLUSH)
+ count <<= 1;
+ else
+ count += LARGE_FLUSH;
+ return count;
}
static int find_common(int fd[2], unsigned char *result_sha1,