MCPcopy Index your code
hub / github.com/git/git / refspec_ref_prefixes

Function refspec_ref_prefixes

refspec.c:257–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void refspec_ref_prefixes(const struct refspec *rs,
258 struct strvec *ref_prefixes)
259{
260 int i;
261 for (i = 0; i < rs->nr; i++) {
262 const struct refspec_item *item = &rs->items[i];
263 const char *prefix = NULL;
264
265 if (item->negative)
266 continue;
267
268 if (rs->fetch) {
269 if (item->exact_sha1)
270 continue;
271 prefix = item->src;
272 } else {
273 /*
274 * Pushes can have an explicit destination like
275 * "foo:bar", or can implicitly use the src for both
276 * ("foo" is the same as "foo:foo").
277 */
278 if (item->dst)
279 prefix = item->dst;
280 else if (item->src && !item->exact_sha1)
281 prefix = item->src;
282 }
283
284 if (!prefix)
285 continue;
286
287 if (item->pattern) {
288 const char *glob = strchr(prefix, '*');
289 strvec_pushf(ref_prefixes, "%.*s",
290 (int)(glob - prefix),
291 prefix);
292 } else {
293 expand_ref_prefix(ref_prefixes, prefix);
294 }
295 }
296}
297
298int match_refname_with_pattern(const char *pattern, const char *refname,
299 const char *replacement, char **result)

Callers 3

transport_pushFunction · 0.85
do_fetchFunction · 0.85
cmd_cloneFunction · 0.85

Calls 2

strvec_pushfFunction · 0.85
expand_ref_prefixFunction · 0.85

Tested by

no test coverage detected