@matheusbsbs / matheus-bagliano / commits / c50b2b4799
Fork 0

Allow builtin-fetch's find_non_local_tags to append onto a list

By allowing the function to append onto the end of an existing list we can do more interesting things, like join the list of tags we want to fetch into the first fetch, rather than the second. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Mar 2, 2008 at 21:35 UTC c50b2b47999134a5da1f9a5ccb36855313e44e7d
1 file changed +8 -8
builtin-fetch.c
+8 -8
@@ -453,7 +453,9 @@ static int add_existing(const char *refname, const unsigned char *sha1,
453 return 0;
454 }
455
456 -static struct ref *find_non_local_tags(struct transport *transport)
456 +static void find_non_local_tags(struct transport *transport,
457 + struct ref **head,
458 + struct ref ***tail)
459 {
460 static struct path_list existing_refs = { NULL, 0, 0, 0 };
461 struct path_list new_refs = { NULL, 0, 0, 1 };
@@ -462,8 +464,6 @@ static struct ref *find_non_local_tags(struct transport *transport)
464 const unsigned char *ref_sha1;
465 const struct ref *tag_ref;
466 struct ref *rm = NULL;
465 - struct ref *ref_map = NULL;
466 - struct ref **tail = &ref_map;
467 const struct ref *ref;
468
469 for_each_ref(add_existing, &existing_refs);
@@ -498,13 +498,11 @@ static struct ref *find_non_local_tags(struct transport *transport)
498 strcpy(rm->peer_ref->name, ref_name);
499 hashcpy(rm->old_sha1, ref_sha1);
500
501 - *tail = rm;
502 - tail = &rm->next;
501 + **tail = rm;
502 + *tail = &rm->next;
503 }
504 free(ref_name);
505 }
506 -
507 - return ref_map;
506 }
507
508 static int do_fetch(struct transport *transport,
@@ -546,7 +544,9 @@ static int do_fetch(struct transport *transport,
544 /* if neither --no-tags nor --tags was specified, do automated tag
545 * following ... */
546 if (tags == TAGS_DEFAULT && autotags) {
549 - ref_map = find_non_local_tags(transport);
547 + struct ref **tail = &ref_map;
548 + ref_map = NULL;
549 + find_non_local_tags(transport, &ref_map, &tail);
550 if (ref_map) {
551 transport_set_option(transport, TRANS_OPT_DEPTH, "0");
552 fetch_refs(transport, ref_map);