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

Function refspec_find_all_matches

refspec.c:403–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403void refspec_find_all_matches(struct refspec *rs,
404 struct refspec_item *query,
405 struct string_list *results)
406{
407 int i;
408 int find_src = !query->src;
409
410 if (find_src && !query->dst)
411 BUG("refspec_find_all_matches: need either src or dst");
412
413 if (refspec_find_negative_match(rs, query))
414 return;
415
416 for (i = 0; i < rs->nr; i++) {
417 struct refspec_item *refspec = &rs->items[i];
418 const char *key = find_src ? refspec->dst : refspec->src;
419 const char *value = find_src ? refspec->src : refspec->dst;
420 const char *needle = find_src ? query->dst : query->src;
421 char **result = find_src ? &query->src : &query->dst;
422
423 if (!refspec->dst || refspec->negative)
424 continue;
425 if (refspec->pattern) {
426 if (match_refname_with_pattern(key, needle, value, result))
427 string_list_append_nodup(results, *result);
428 } else if (!strcmp(needle, key)) {
429 string_list_append(results, value);
430 }
431 }
432}
433
434int refspec_find_match(struct refspec *rs, struct refspec_item *query)
435{

Callers 1

get_stale_heads_cbFunction · 0.85

Calls 4

string_list_append_nodupFunction · 0.85
string_list_appendFunction · 0.70

Tested by

no test coverage detected