Implement "quickfetch" hack as part of our standard fetch behavior
commit5c547a9ac122c3fd311add483ac031cebf4966f8
authorShawn O. Pearce <spearce@spearce.org>
Thu, 15 May 2008 03:47:35 +0000 (14 23:47 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 17 May 2008 03:59:50 +0000 (16 23:59 -0400)
tree85c4ab7657dbacf5c25e35f8d1f4034e2665d7b3
parent9451fd14174df90ff35907e2d9e62279e26693c0
Implement "quickfetch" hack as part of our standard fetch behavior

If we already have all of the objects necessary to complete the
set of refs requested by the application for this fetch we don't
actually need to invoke FetchConnection.fetch() to copy objects
into the local repository.  Instead we just have to finish doing
the ref linking, to show that they are reachable.

C Git dubbed this "quickfetch" and used it initially to avoid a
copy of objects from an alternate repository into this repository
in the corner case of when you are fetching from one of your own
alternate repositories.  Later C Git extended this into the fetch
process itself for all transport types, allowing for cheaper use
for a fetch+merge+reset+merge without needing to fetch all of the
objects again during the second merge attempt.

The algorithm behind quickfetch is also essential to handling the
automatic tag following done on the remote side of a fetch, if the
remote supports it.  We may (or may not) get tag objects from the
remote when we fetch the things they refer to.  We cannot tell if
those tags are complete unless we attempt to "quickfetch" them
after the initial object request has finished transferring.

We use an ObjectWalk and populate in all of the objects we need.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java