summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-10-31 18:36:01 +0100
committerJunio C Hamano <gitster@pobox.com>2015-11-01 09:58:20 -0800
commitbcf8cc25acb3378bf62f2cfc27c28302585841c0 (patch)
treed287bf265da4c1cd17d36c72d0712c48019dcb18 /wt-status.c
parent7ca8c18950c3f843cedba897b44f9c79b5ab44eb (diff)
downloadgit-bcf8cc25acb3378bf62f2cfc27c28302585841c0.tar.gz
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>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/wt-status.c b/wt-status.c
index e8c39efbcb..ac05b9b73d 100644
--- a/wt-status.c
+++ b/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);
if (stat_tracking_info(branch, &num_ours, &num_theirs, &base) < 0) {
- if (!base) {
- fputc(s->null_termination ? '\0' : '\n', s->fp);
- return;
- }
+ if (!base)
+ goto conclude;
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);
free((char *)base);
- if (!upstream_is_gone && !num_ours && !num_theirs) {
- fputc(s->null_termination ? '\0' : '\n', s->fp);
- return;
- }
+ if (!upstream_is_gone && !num_ours && !num_theirs)
+ goto conclude;
#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, "]");
+ conclude:
fputc(s->null_termination ? '\0' : '\n', s->fp);
}