git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] Make git-fetch follow tags we already have objects for sooner
@ 2008-02-28  8:42 Shawn O. Pearce
  2008-02-29  8:41 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Shawn O. Pearce @ 2008-02-28  8:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Daniel Barkalow

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>
---
 builtin-fetch.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index 834fbc6..a80f95b 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -101,6 +101,10 @@ static void add_merge_config(struct ref **head,
 	}
 }
 
+static void find_non_local_tags(struct transport *transport,
+			struct ref **head,
+			struct ref ***tail);
+
 static struct ref *get_ref_map(struct transport *transport,
 			       struct refspec *refs, int ref_count, int tags,
 			       int *autotags)
@@ -159,6 +163,8 @@ static struct ref *get_ref_map(struct transport *transport,
 			ref_map->merge = 1;
 		}
 	}
+	if (tags == TAGS_DEFAULT && autotags)
+		find_non_local_tags(transport, &ref_map, &tail);
 	ref_remove_duplicates(ref_map);
 
 	return ref_map;
-- 
1.5.4.3.393.g5540

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-03-02 14:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-28  8:42 [PATCH 3/4] Make git-fetch follow tags we already have objects for sooner Shawn O. Pearce
2008-02-29  8:41 ` Junio C Hamano
2008-02-29 22:34   ` Shawn O. Pearce
2008-02-29 22:39     ` Daniel Barkalow
2008-03-01  4:25       ` Shawn O. Pearce
2008-03-01 16:33         ` Daniel Barkalow
2008-03-02 14:13           ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).