Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
wt-status: exit early using goto in wt_shortstatus_print_tracking()
author
René Scharfe
<l.s.r@web.de>
Sat, 31 Oct 2015 17:36:01 +0000
(18:36 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 1 Nov 2015 17:58:20 +0000
(09:58 -0800)
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>
wt-status.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7ca8c18
)
diff --git
a/wt-status.c
b/wt-status.c
index e8c39efbcb24203577458662e0ddfe9928a332b7..ac05b9b73d79386dee4c5d7f9719a9a397dd4ca4 100644
(file)
--- 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) {
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;
}
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);
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))
#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);
}