{"thread":{"id":"12447","subject":"[PATCH v3 7/8] Make git-fetch follow tags we already have objects for sooner","startedAt":"2008-03-03T02:35:25Z","lastAt":"2008-03-03T02:35:25Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":3,"patchTotal":8},"messages":[{"id":"70732","messageId":"20080303023525.GG9966@spearce.org","threadId":"12447","inReplyTo":null,"subject":"[PATCH v3 7/8] Make git-fetch follow tags we already have objects for sooner","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-03-03T02:35:25Z","receivedAt":"2008-03-03T02:35:25Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If autofollowing of tags is enabled, we see a new tag on the remote\nthat we don't have, and we already have the SHA-1 object that the\ntag is peeled to, then we can fetch the tag while we are fetching\nthe other objects on the first connection.\n\nThis is a slight optimization for projects that have a habit of\ntagging a release commit after most users have already seen and\ndownloaded that commit object through a prior fetch session. In\nsuch cases the users may still find new objects in branch heads,\nbut the new tag will now also be part of the first pack transfer\nand the subsequent connection to autofollow tags is not required.\n\nCurrently git.git does not benefit from this optimization as any\nrelease usually gets a new commit at the same time that it gets a\nnew release tag, however git-gui.git and many other projects are\nin the habit of tagging fairly old commits.\n\nUsers who did not already have the tagged commit still require\nopening a second connection to autofollow the tag, as we are unable\nto determine on the client side if $tag^{} will be sent to the\nclient during the first transfer or not.  Such computation must be\nperformed on the remote side of the connection and is deferred to\nanother series of changes.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-fetch.c |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex 3758d48..a58efa6 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -101,6 +101,10 @@ static void add_merge_config(struct ref **head,\n \t}\n }\n \n+static void find_non_local_tags(struct transport *transport,\n+\t\t\tstruct ref **head,\n+\t\t\tstruct ref ***tail);\n+\n static struct ref *get_ref_map(struct transport *transport,\n \t\t\t       struct refspec *refs, int ref_count, int tags,\n \t\t\t       int *autotags)\n@@ -160,6 +164,8 @@ static struct ref *get_ref_map(struct transport *transport,\n \t\t\ttail = &ref_map->next;\n \t\t}\n \t}\n+\tif (tags == TAGS_DEFAULT && *autotags)\n+\t\tfind_non_local_tags(transport, &ref_map, &tail);\n \tref_remove_duplicates(ref_map);\n \n \treturn ref_map;\n-- \n1.5.4.3.468.g36990\n\n"}]}