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

Function stat_tracking_info

remote.c:2274–2289  ·  view source on GitHub ↗

* Lookup the tracking branch for the given branch and if present, optionally * compute the commit ahead/behind values for the pair. * * If for_push is true, the tracking branch refers to the push branch, * otherwise it refers to the upstream branch. * * The name of the tracking branch (or NULL if it is not defined) is * returned via *tracking_name, if it is not itself NULL. * * If abf is

Source from the content-addressed store, hash-verified

2272 * identical. Returns 1 if commits are different.
2273 */
2274int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
2275 const char **tracking_name, int for_push,
2276 enum ahead_behind_flags abf)
2277{
2278 const char *base;
2279
2280 /* Cannot stat unless we are marked to build on top of somebody else. */
2281 base = for_push ? branch_get_push(branch, NULL) :
2282 branch_get_upstream(branch, NULL);
2283 if (tracking_name)
2284 *tracking_name = base;
2285 if (!base)
2286 return -1;
2287
2288 return stat_branch_pair(branch->refname, base, num_ours, num_theirs, abf);
2289}
2290
2291static char *resolve_compare_branch(struct branch *branch, const char *name)
2292{

Callers 3

fill_remote_ref_detailsFunction · 0.85

Calls 3

branch_get_pushFunction · 0.85
branch_get_upstreamFunction · 0.85
stat_branch_pairFunction · 0.85

Tested by

no test coverage detected