MCPcopy Create free account
hub / github.com/git/git / ref_remove_duplicates

Function ref_remove_duplicates

remote.c:908–940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

906}
907
908struct 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
942int remote_has_url(struct remote *remote, const char *url)
943{

Callers 1

get_ref_mapFunction · 0.85

Calls 3

string_list_insertFunction · 0.85
handle_duplicateFunction · 0.85
string_list_clearFunction · 0.85

Tested by

no test coverage detected