* 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
| 2272 | * identical. Returns 1 if commits are different. |
| 2273 | */ |
| 2274 | int 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 | |
| 2291 | static char *resolve_compare_branch(struct branch *branch, const char *name) |
| 2292 | { |
no test coverage detected