{"thread":{"id":"12396","subject":"[PATCH v2 4/7] Allow builtin-fetch's find_non_local_tags to append onto a list","startedAt":"2008-03-01T05:25:08Z","lastAt":"2008-03-01T05:25:08Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":2,"patchTotal":7},"messages":[{"id":"70472","messageId":"20080301052508.GD27300@spearce.org","threadId":"12396","inReplyTo":null,"subject":"[PATCH v2 4/7] Allow builtin-fetch's find_non_local_tags to append onto a list","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-03-01T05:25:08Z","receivedAt":"2008-03-01T05:25:08Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"By allowing the function to append onto the end of an existing list\nwe can do more interesting things, like join the list of tags we\nwant to fetch into the first fetch, rather than the second.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-fetch.c |   16 ++++++++--------\n 1 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex 5bce20f..1d3ce77 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -453,7 +453,9 @@ static int add_existing(const char *refname, const unsigned char *sha1,\n \treturn 0;\n }\n \n-static struct ref *find_non_local_tags(struct transport *transport)\n+static void find_non_local_tags(struct transport *transport,\n+\t\t\tstruct ref **head,\n+\t\t\tstruct ref ***tail)\n {\n \tstatic struct path_list existing_refs = { NULL, 0, 0, 0 };\n \tstruct path_list new_refs = { NULL, 0, 0, 1 };\n@@ -462,8 +464,6 @@ static struct ref *find_non_local_tags(struct transport *transport)\n \tconst unsigned char *ref_sha1;\n \tconst struct ref *tag_ref;\n \tstruct ref *rm = NULL;\n-\tstruct ref *ref_map = NULL;\n-\tstruct ref **tail = &ref_map;\n \tconst struct ref *ref;\n \n \tfor_each_ref(add_existing, &existing_refs);\n@@ -498,13 +498,11 @@ static struct ref *find_non_local_tags(struct transport *transport)\n \t\t\tstrcpy(rm->peer_ref->name, ref_name);\n \t\t\thashcpy(rm->old_sha1, ref_sha1);\n \n-\t\t\t*tail = rm;\n-\t\t\ttail = &rm->next;\n+\t\t\t**tail = rm;\n+\t\t\t*tail = &rm->next;\n \t\t}\n \t\tfree(ref_name);\n \t}\n"}]}