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

Function search_ref_dir

refs/ref-cache.c:132–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132int search_ref_dir(struct ref_dir *dir, const char *refname, size_t len)
133{
134 struct ref_entry **r;
135 struct string_slice key;
136
137 if (refname == NULL || !dir->nr)
138 return -1;
139
140 sort_ref_dir(dir);
141 key.len = len;
142 key.str = refname;
143 r = bsearch(&key, dir->entries, dir->nr, sizeof(*dir->entries),
144 ref_entry_cmp_sslice);
145
146 if (!r)
147 return -1;
148
149 return r - dir->entries;
150}
151
152/*
153 * Search for a directory entry directly within dir (without

Callers 2

search_for_subdirFunction · 0.85

Calls 1

sort_ref_dirFunction · 0.85

Tested by

no test coverage detected