| 906 | } |
| 907 | |
| 908 | struct ref *ref_remove_duplicates(struct ref *ref_map) |
| 909 | { |
| 910 | struct string_list refs = STRING_LIST_INIT_NODUP; |
| 911 | struct ref *retval = NULL; |
| 912 | struct ref **p = &retval; |
| 913 | |
| 914 | while (ref_map) { |
| 915 | struct ref *ref = ref_map; |
| 916 | |
| 917 | ref_map = ref_map->next; |
| 918 | ref->next = NULL; |
| 919 | |
| 920 | if (!ref->peer_ref) { |
| 921 | *p = ref; |
| 922 | p = &ref->next; |
| 923 | } else { |
| 924 | struct string_list_item *item = |
| 925 | string_list_insert(&refs, ref->peer_ref->name); |
| 926 | |
| 927 | if (item->util) { |
| 928 | /* Entry already existed */ |
| 929 | handle_duplicate((struct ref *)item->util, ref); |
| 930 | } else { |
| 931 | *p = ref; |
| 932 | p = &ref->next; |
| 933 | item->util = ref; |
| 934 | } |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | string_list_clear(&refs, 0); |
| 939 | return retval; |
| 940 | } |
| 941 | |
| 942 | int remote_has_url(struct remote *remote, const char *url) |
| 943 | { |
no test coverage detected