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

Function include_by_branch

config.c:297–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297static int include_by_branch(struct config_include_data *data,
298 const char *cond, size_t cond_len)
299{
300 int flags;
301 int ret;
302 struct strbuf pattern = STRBUF_INIT;
303 const char *refname, *shortname;
304
305 if (!data->repo || data->repo->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
306 return 0;
307
308 refname = refs_resolve_ref_unsafe(get_main_ref_store(data->repo),
309 "HEAD", 0, NULL, &flags);
310 if (!refname ||
311 !(flags & REF_ISSYMREF) ||
312 !skip_prefix(refname, "refs/heads/", &shortname))
313 return 0;
314
315 strbuf_add(&pattern, cond, cond_len);
316 add_trailing_starstar_for_dir(&pattern);
317 ret = !wildmatch(pattern.buf, shortname, WM_PATHNAME);
318 strbuf_release(&pattern);
319 return ret;
320}
321
322static int add_remote_url(const char *var, const char *value,
323 const struct config_context *ctx UNUSED, void *data)

Callers 1

Calls 6

refs_resolve_ref_unsafeFunction · 0.85
get_main_ref_storeFunction · 0.85
strbuf_addFunction · 0.85
wildmatchFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected