stat_tracking_info: return +1 when branches not equal
Extend stat_tracking_info() to return +1 when branches are not equal and to take a new "enum ahead_behind_flags" argument to allow skipping the (possibly expensive) ahead/behind computation. This will be used in the next commit to allow "git status" to avoid full ahead/behind calculations for performance reasons. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
1eaabe34fc
commit
d7d1b496ae
@ -1796,7 +1796,8 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
|
||||
|
||||
color_fprintf(s->fp, branch_color_local, "%s", branch_name);
|
||||
|
||||
if (stat_tracking_info(branch, &num_ours, &num_theirs, &base) < 0) {
|
||||
if (stat_tracking_info(branch, &num_ours, &num_theirs, &base,
|
||||
AHEAD_BEHIND_FULL) < 0) {
|
||||
if (!base)
|
||||
goto conclude;
|
||||
|
||||
@ -1933,7 +1934,8 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
|
||||
/* Lookup stats on the upstream tracking branch, if set. */
|
||||
branch = branch_get(branch_name);
|
||||
base = NULL;
|
||||
ab_info = (stat_tracking_info(branch, &nr_ahead, &nr_behind, &base) == 0);
|
||||
ab_info = (stat_tracking_info(branch, &nr_ahead, &nr_behind,
|
||||
&base, AHEAD_BEHIND_FULL) >= 0);
|
||||
if (base) {
|
||||
base = shorten_unambiguous_ref(base, 0);
|
||||
fprintf(s->fp, "# branch.upstream %s%c", base, eol);
|
||||
|
Reference in New Issue
Block a user