diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2018-01-09 18:50:15 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-24 13:48:38 -0800 |
commit | d7d1b496aeea5a151c826683ed28c57ef0ac9389 (patch) | |
tree | 39f8418293a7f36f2d28785e2285d56df026d1b0 /wt-status.c | |
parent | 1eaabe34fc6f486367a176207420378f587d3b48 (diff) | |
download | git-d7d1b496aeea5a151c826683ed28c57ef0ac9389.tar.gz |
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>
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wt-status.c b/wt-status.c index ef26f07446..1137f27aa6 100644 --- a/wt-status.c +++ b/wt-status.c @@ -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); |