wt-status: exit early using goto in wt_shortstatus_print_tracking()
Deduplicate printing the line terminator by jumping to the end of the function. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7ca8c18950
commit
bcf8cc25ac
13
wt-status.c
13
wt-status.c
@ -1535,10 +1535,8 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
|
|||||||
color_fprintf(s->fp, branch_color_local, "%s", branch_name);
|
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) < 0) {
|
||||||
if (!base) {
|
if (!base)
|
||||||
fputc(s->null_termination ? '\0' : '\n', s->fp);
|
goto conclude;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream_is_gone = 1;
|
upstream_is_gone = 1;
|
||||||
}
|
}
|
||||||
@ -1548,10 +1546,8 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
|
|||||||
color_fprintf(s->fp, branch_color_remote, "%s", base);
|
color_fprintf(s->fp, branch_color_remote, "%s", base);
|
||||||
free((char *)base);
|
free((char *)base);
|
||||||
|
|
||||||
if (!upstream_is_gone && !num_ours && !num_theirs) {
|
if (!upstream_is_gone && !num_ours && !num_theirs)
|
||||||
fputc(s->null_termination ? '\0' : '\n', s->fp);
|
goto conclude;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LABEL(string) (s->no_gettext ? (string) : _(string))
|
#define LABEL(string) (s->no_gettext ? (string) : _(string))
|
||||||
|
|
||||||
@ -1572,6 +1568,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
color_fprintf(s->fp, header_color, "]");
|
color_fprintf(s->fp, header_color, "]");
|
||||||
|
conclude:
|
||||||
fputc(s->null_termination ? '\0' : '\n', s->fp);
|
fputc(s->null_termination ? '\0' : '\n', s->fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user