diff options
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c index ff4b32426a..c8c2d77524 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1363,6 +1363,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s) const char *base; const char *branch_name; int num_ours, num_theirs; + int upstream_is_gone = 0; color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "## "); @@ -1380,20 +1381,37 @@ static void wt_shortstatus_print_tracking(struct wt_status *s) branch = branch_get(s->branch + 11); if (s->is_initial) color_fprintf(s->fp, header_color, _("Initial commit on ")); - if (!stat_tracking_info(branch, &num_ours, &num_theirs)) { - color_fprintf(s->fp, branch_color_local, "%s", branch_name); + + color_fprintf(s->fp, branch_color_local, "%s", branch_name); + + switch (stat_tracking_info(branch, &num_ours, &num_theirs)) { + case 0: + /* no base */ fputc(s->null_termination ? '\0' : '\n', s->fp); return; + case -1: + /* with "gone" base */ + upstream_is_gone = 1; + break; + default: + /* with base */ + break; } base = branch->merge[0]->dst; base = shorten_unambiguous_ref(base, 0); - color_fprintf(s->fp, branch_color_local, "%s", branch_name); color_fprintf(s->fp, header_color, "..."); color_fprintf(s->fp, branch_color_remote, "%s", base); + if (!upstream_is_gone && !num_ours && !num_theirs) { + fputc(s->null_termination ? '\0' : '\n', s->fp); + return; + } + color_fprintf(s->fp, header_color, " ["); - if (!num_ours) { + if (upstream_is_gone) { + color_fprintf(s->fp, header_color, _("gone")); + } else if (!num_ours) { color_fprintf(s->fp, header_color, _("behind ")); color_fprintf(s->fp, branch_color_remote, "%d", num_theirs); } else if (!num_theirs) { |