X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin%2Ffetch.c;h=6eb1dfea092e2873c5910bf4389d3b071786d8b0;hb=e8344e866655cfae1f870d7e8d5046c1bdf08adf;hp=8470850415c14cad8ceeca9f6baef46ab6feabc3;hpb=3c656899cdfbfdd40987625c4615a8c941d5968a;p=git.git diff --git a/builtin/fetch.c b/builtin/fetch.c index 847085041..6eb1dfea0 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -528,7 +528,7 @@ static int add_existing(const char *refname, const unsigned char *sha1, int flag, void *cbdata) { struct string_list *list = (struct string_list *)cbdata; - struct string_list_item *item = string_list_insert(refname, list); + struct string_list_item *item = string_list_insert(list, refname); item->util = (void *)sha1; return 0; } @@ -574,9 +574,10 @@ static void find_non_local_tags(struct transport *transport, { struct string_list existing_refs = { NULL, 0, 0, 0 }; struct string_list remote_refs = { NULL, 0, 0, 0 }; - struct tag_data data = {head, tail}; + struct tag_data data; const struct ref *ref; struct string_list_item *item = NULL; + data.head = head; data.tail = tail; for_each_ref(add_existing, &existing_refs); for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) { @@ -616,7 +617,7 @@ static void find_non_local_tags(struct transport *transport, string_list_has_string(&existing_refs, ref->name)) continue; - item = string_list_insert(ref->name, &remote_refs); + item = string_list_insert(&remote_refs, ref->name); item->util = (void *)ref->old_sha1; } string_list_clear(&existing_refs, 0); @@ -633,7 +634,7 @@ static void find_non_local_tags(struct transport *transport, * For all the tags in the remote_refs string list, call * add_to_tail to add them to the list of refs to be fetched */ - for_each_string_list(add_to_tail, &remote_refs, &data); + for_each_string_list(&remote_refs, add_to_tail, &data); string_list_clear(&remote_refs, 0); } @@ -695,8 +696,8 @@ static int do_fetch(struct transport *transport, for (rm = ref_map; rm; rm = rm->next) { if (rm->peer_ref) { - peer_item = string_list_lookup(rm->peer_ref->name, - &existing_refs); + peer_item = string_list_lookup(&existing_refs, + rm->peer_ref->name); if (peer_item) hashcpy(rm->peer_ref->old_sha1, peer_item->util); @@ -745,7 +746,7 @@ static int get_one_remote_for_fetch(struct remote *remote, void *priv) { struct string_list *list = priv; if (!remote->skip_default_update) - string_list_append(remote->name, list); + string_list_append(list, remote->name); return 0; } @@ -764,8 +765,8 @@ static int get_remote_group(const char *key, const char *value, void *priv) int space = strcspn(value, " \t\n"); while (*value) { if (space > 1) { - string_list_append(xstrndup(value, space), - g->list); + string_list_append(g->list, + xstrndup(value, space)); } value += space + (value[space] != '\0'); space = strcspn(value, " \t\n"); @@ -778,7 +779,8 @@ static int get_remote_group(const char *key, const char *value, void *priv) static int add_remote_or_group(const char *name, struct string_list *list) { int prev_nr = list->nr; - struct remote_group_data g = { name, list }; + struct remote_group_data g; + g.name = name; g.list = list; git_config(get_remote_group, &g); if (list->nr == prev_nr) { @@ -786,7 +788,7 @@ static int add_remote_or_group(const char *name, struct string_list *list) if (!remote_is_configured(name)) return 0; remote = remote_get(name); - string_list_append(remote->name, list); + string_list_append(list, remote->name); } return 1; }