Use ".have" advertisements during push to reduce what is transferred
commit5d3a6706eef2b81ba6591b883619721cdff80ee9
authorShawn O. Pearce <spearce@spearce.org>
Wed, 24 Sep 2008 19:05:53 +0000 (24 12:05 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 24 Sep 2008 22:30:32 +0000 (25 00:30 +0200)
treef84acb6cf50f03bb70619e08633c9adce858dc9f
parent8363f12135a7d0ff0b5fea7d5a35d294c0479518
Use ".have" advertisements during push to reduce what is transferred

If a remote peer has an alternate object database it might show
the refs of the alternate repositories by sending special ".have"
ref lines in the advertisement.  These can be used to compute a
better common base, avoiding uploading objects which the remote
side has physically available (and complete), but which aren't in
the ref space of the remote repository.

As most repositories have more than one ref, there can be more than
one ".have" line, and the same object might appear more than once.
Collecting these into a special "additionalHaves" set avoids them
from showing up in the advertised refs collection.

PackWriter already gracefully skips over remoteObjects that
we don't have locally.  We can simply include the entire set
of additionalHaves when we start creating a pack for the push
transfer and PackWriter will seek the best common base available.
Anything advertised that we lack will be silently skipped.

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/BasePackConnection.java
org.spearce.jgit/src/org/spearce/jgit/transport/BasePackPushConnection.java