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

Function resolve_compare_branch

remote.c:2291–2312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2289}
2290
2291static char *resolve_compare_branch(struct branch *branch, const char *name)
2292{
2293 const char *resolved = NULL;
2294
2295 if (!branch || !name)
2296 return NULL;
2297
2298 if (!strcasecmp(name, "@{upstream}")) {
2299 resolved = branch_get_upstream(branch, NULL);
2300 } else if (!strcasecmp(name, "@{push}")) {
2301 resolved = branch_get_push(branch, NULL);
2302 } else {
2303 warning(_("ignoring value '%s' for status.compareBranches, "
2304 "only @{upstream} and @{push} are supported"),
2305 name);
2306 return NULL;
2307 }
2308
2309 if (resolved)
2310 return xstrdup(resolved);
2311 return NULL;
2312}
2313
2314static void format_branch_comparison(struct strbuf *sb,
2315 bool up_to_date,

Callers 1

format_tracking_infoFunction · 0.85

Calls 4

branch_get_upstreamFunction · 0.85
branch_get_pushFunction · 0.85
warningFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected