aboutsummaryrefslogtreecommitdiff
path: root/builtin-fetch.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-03-03 22:27:40 -0500
committerJunio C Hamano <gitster@pobox.com>2008-03-04 23:28:15 -0800
commit41fa7d2eaeace0c5c23fc75a3d5cc9efbad467a5 (patch)
treebdb177268b0c4ba90076e1e6c39cb22aa890570f /builtin-fetch.c
parent348e390b17e7a2b0618fbbfe8cdefa3d73ecbea2 (diff)
downloadgit-41fa7d2eaeace0c5c23fc75a3d5cc9efbad467a5.tar.gz
git-41fa7d2eaeace0c5c23fc75a3d5cc9efbad467a5.tar.xz
Teach git-fetch to exploit server side automatic tag following
If the remote peer upload-pack process supports the include-tag protocol extension then we can avoid running a second fetch cycle on the client side by letting the server send us the annotated tags along with the objects it is packing for us. In the following graph we can now fetch both "tag1" and "tag2" on the same connection that we fetched "master" from the remote when we only have L available on the local side: T - tag1 S - tag2 / / L - o ------ o ------ B \ \ \ \ origin/master master The objects for "tag1" are implicitly downloaded without our direct knowledge. The existing "quickfetch" optimization within git-fetch discovers that tag1 is complete after the first connection and does not open a second connection. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r--builtin-fetch.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 26c3d74b7..55f611e3c 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -555,6 +555,8 @@ static int do_fetch(struct transport *transport,
read_ref(rm->peer_ref->name, rm->peer_ref->old_sha1);
}
+ if (tags == TAGS_DEFAULT && autotags)
+ transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
if (fetch_refs(transport, ref_map)) {
free_refs(ref_map);
return 1;
@@ -568,6 +570,7 @@ static int do_fetch(struct transport *transport,
ref_map = NULL;
find_non_local_tags(transport, &ref_map, &tail);
if (ref_map) {
+ transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, NULL);
transport_set_option(transport, TRANS_OPT_DEPTH, "0");
fetch_refs(transport, ref_map);
}