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

Function remove_duplicates_in_refs

fetch-pack.c:2028–2047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2026}
2027
2028static int remove_duplicates_in_refs(struct ref **ref, int nr)
2029{
2030 struct string_list names = STRING_LIST_INIT_NODUP;
2031 int src, dst;
2032
2033 for (src = dst = 0; src < nr; src++) {
2034 struct string_list_item *item;
2035 item = string_list_insert(&names, ref[src]->name);
2036 if (item->util)
2037 continue; /* already have it */
2038 item->util = ref[src];
2039 if (src != dst)
2040 ref[dst] = ref[src];
2041 dst++;
2042 }
2043 for (src = dst; src < nr; src++)
2044 ref[src] = NULL;
2045 string_list_clear(&names, 0);
2046 return dst;
2047}
2048
2049static void update_shallow(struct fetch_pack_args *args,
2050 struct ref **sought, int nr_sought,

Callers 1

fetch_packFunction · 0.85

Calls 2

string_list_insertFunction · 0.85
string_list_clearFunction · 0.85

Tested by

no test coverage detected