UploadPack: Only recompute okToGiveUp() if bases changed
commit556ea233d3b105769dd4b8fcb8a72d545cd44aa1
authorShawn O. Pearce <spearce@spearce.org>
Fri, 12 Jun 2009 23:00:19 +0000 (12 16:00 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sun, 14 Jun 2009 20:41:31 +0000 (14 22:41 +0200)
tree4ef1933523f2faf4dd96e14ad58d196210e08e6a
parentc6fedc30ab0b7e1d7ff7aa012fe764c5a0631577
UploadPack: Only recompute okToGiveUp() if bases changed

If we get a commit we don't recognize, but we haven't added any new
common bases to the commonBase set since the last time we ran the
okToGiveUp() algorithm, then there is no point in running it again,
as the result will not change.  Instead we cache the result in a
Boolean and just return the cached result until another common base
can be found and added to the set.

This helps to fix a performance problem when the client is 50,000
commits ahead of the server, and keeps sending them in "have"
lines, but the server doesn't recognize them.  On every "have"
line we will not have updated the common base, but we also aren't
yet satisfied that it is OK to give up negotiation.

Between the changes introduced by the parent commit and this commit,
negotiation in this case of 50,000 ahead now completes instantly,
instead of taking hours.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java