Make git-fetch follow tags we already have objects for sooner
authorShawn O. Pearce <spearce@spearce.org>
Mon, 3 Mar 2008 02:35:25 +0000 (21:35 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Mar 2008 08:05:45 +0000 (00:05 -0800)
commit767f176a1f11e07b9098f5094dbd9f4033e50504
tree4c611130c38b7c1cc949f2aff2404e2a1f6b5898
parent49aaddd102aff1f0fc986629f3dc22a872f202ce
Make git-fetch follow tags we already have objects for sooner

If autofollowing of tags is enabled, we see a new tag on the remote
that we don't have, and we already have the SHA-1 object that the
tag is peeled to, then we can fetch the tag while we are fetching
the other objects on the first connection.

This is a slight optimization for projects that have a habit of
tagging a release commit after most users have already seen and
downloaded that commit object through a prior fetch session. In
such cases the users may still find new objects in branch heads,
but the new tag will now also be part of the first pack transfer
and the subsequent connection to autofollow tags is not required.

Currently git.git does not benefit from this optimization as any
release usually gets a new commit at the same time that it gets a
new release tag, however git-gui.git and many other projects are
in the habit of tagging fairly old commits.

Users who did not already have the tagged commit still require
opening a second connection to autofollow the tag, as we are unable
to determine on the client side if $tag^{} will be sent to the
client during the first transfer or not.  Such computation must be
performed on the remote side of the connection and is deferred to
another series of changes.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-fetch.c