summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-03-13 11:42:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-03-17 05:11:02 (GMT)
commit3b691cccb02e660002a7ff414ad21ddac932dc6c (patch)
tree0f8050bc5ae4a49887cc336015244c1b35023cf5 /wt-status.c
parentb9691db4f90164b3de2c2ea7e82ea545f2056f52 (diff)
downloadgit-3b691cccb02e660002a7ff414ad21ddac932dc6c.zip
git-3b691cccb02e660002a7ff414ad21ddac932dc6c.tar.gz
git-3b691cccb02e660002a7ff414ad21ddac932dc6c.tar.bz2
wt-status: move wt_status_get_state() out to wt_status_print()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/wt-status.c b/wt-status.c
index 96b3701..40dced3 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1031,32 +1031,30 @@ void wt_status_get_state(struct wt_status_state *state)
}
}
-static void wt_status_print_state(struct wt_status *s)
+static void wt_status_print_state(struct wt_status *s,
+ struct wt_status_state *state)
{
const char *state_color = color(WT_STATUS_HEADER, s);
- struct wt_status_state state;
-
- memset(&state, 0, sizeof(state));
- wt_status_get_state(&state);
-
- if (state.merge_in_progress)
- show_merge_in_progress(s, &state, state_color);
- else if (state.am_in_progress)
- show_am_in_progress(s, &state, state_color);
- else if (state.rebase_in_progress || state.rebase_interactive_in_progress)
- show_rebase_in_progress(s, &state, state_color);
- else if (state.cherry_pick_in_progress)
- show_cherry_pick_in_progress(s, &state, state_color);
- if (state.bisect_in_progress)
- show_bisect_in_progress(s, &state, state_color);
- free(state.branch);
- free(state.onto);
+ if (state->merge_in_progress)
+ show_merge_in_progress(s, state, state_color);
+ else if (state->am_in_progress)
+ show_am_in_progress(s, state, state_color);
+ else if (state->rebase_in_progress || state->rebase_interactive_in_progress)
+ show_rebase_in_progress(s, state, state_color);
+ else if (state->cherry_pick_in_progress)
+ show_cherry_pick_in_progress(s, state, state_color);
+ if (state->bisect_in_progress)
+ show_bisect_in_progress(s, state, state_color);
}
void wt_status_print(struct wt_status *s)
{
const char *branch_color = color(WT_STATUS_ONBRANCH, s);
const char *branch_status_color = color(WT_STATUS_HEADER, s);
+ struct wt_status_state state;
+
+ memset(&state, 0, sizeof(state));
+ wt_status_get_state(&state);
if (s->branch) {
const char *on_what = _("On branch ");
@@ -1075,7 +1073,10 @@ void wt_status_print(struct wt_status *s)
wt_status_print_tracking(s);
}
- wt_status_print_state(s);
+ wt_status_print_state(s, &state);
+ free(state.branch);
+ free(state.onto);
+
if (s->is_initial) {
status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit"));