status: factor two rebase-related messages together

Signed-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Guillaume Pagès 2015-06-30 15:01:12 +02:00 committed by Junio C Hamano
parent 7974889a05
commit 05eb563553

View File

@ -1026,13 +1026,10 @@ static int split_commit_in_progress(struct wt_status *s)
return split_in_progress; return split_in_progress;
} }
static void show_rebase_in_progress(struct wt_status *s, static void print_rebase_state(struct wt_status *s,
struct wt_status_state *state, struct wt_status_state *state,
const char *color) const char *color)
{ {
struct stat st;
if (has_unmerged(s)) {
if (state->branch) if (state->branch)
status_printf_ln(s, color, status_printf_ln(s, color,
_("You are currently rebasing branch '%s' on '%s'."), _("You are currently rebasing branch '%s' on '%s'."),
@ -1041,6 +1038,16 @@ static void show_rebase_in_progress(struct wt_status *s,
else else
status_printf_ln(s, color, status_printf_ln(s, color,
_("You are currently rebasing.")); _("You are currently rebasing."));
}
static void show_rebase_in_progress(struct wt_status *s,
struct wt_status_state *state,
const char *color)
{
struct stat st;
if (has_unmerged(s)) {
print_rebase_state(s, state, color);
if (s->hints) { if (s->hints) {
status_printf_ln(s, color, status_printf_ln(s, color,
_(" (fix conflicts and then run \"git rebase --continue\")")); _(" (fix conflicts and then run \"git rebase --continue\")"));
@ -1050,14 +1057,7 @@ static void show_rebase_in_progress(struct wt_status *s,
_(" (use \"git rebase --abort\" to check out the original branch)")); _(" (use \"git rebase --abort\" to check out the original branch)"));
} }
} else if (state->rebase_in_progress || !stat(git_path("MERGE_MSG"), &st)) { } else if (state->rebase_in_progress || !stat(git_path("MERGE_MSG"), &st)) {
if (state->branch) print_rebase_state(s, state, color);
status_printf_ln(s, color,
_("You are currently rebasing branch '%s' on '%s'."),
state->branch,
state->onto);
else
status_printf_ln(s, color,
_("You are currently rebasing."));
if (s->hints) if (s->hints)
status_printf_ln(s, color, status_printf_ln(s, color,
_(" (all conflicts fixed: run \"git rebase --continue\")")); _(" (all conflicts fixed: run \"git rebase --continue\")"));