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

Function ref_match

ls-refs.c:54–67  ·  view source on GitHub ↗

* Check if one of the prefixes is a prefix of the ref. * If no prefixes were provided, all refs match. */

Source from the content-addressed store, hash-verified

52 * If no prefixes were provided, all refs match.
53 */
54static int ref_match(const struct strvec *prefixes, const char *refname)
55{
56 if (!prefixes->nr)
57 return 1; /* no restriction */
58
59 for (size_t i = 0; i < prefixes->nr; i++) {
60 const char *prefix = prefixes->v[i];
61
62 if (starts_with(refname, prefix))
63 return 1;
64 }
65
66 return 0;
67}
68
69struct ls_refs_data {
70 unsigned peel;

Callers 1

send_refFunction · 0.85

Calls 1

starts_withFunction · 0.85

Tested by

no test coverage detected