diff options
author | Matthieu Moy <Matthieu.Moy@imag.fr> | 2013-04-02 16:20:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-02 14:22:55 -0700 |
commit | db4ef4496e7a99809f7caa52e8821320e5cca7bc (patch) | |
tree | c836d1591e398ed5f0cb7874357788404fe58cf1 /wt-status.c | |
parent | cc3e4eba723570bf77902c017611ee02bb86c8b3 (diff) | |
download | git-db4ef4496e7a99809f7caa52e8821320e5cca7bc.tar.gz |
status: show 'revert' state and status hint
This is the logical equivalent for "git status" of 3ee4452 (bash: teach
__git_ps1 about REVERT_HEAD).
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c index cea8e55d8b..39f888bcc8 100644 --- a/wt-status.c +++ b/wt-status.c @@ -965,6 +965,24 @@ static void show_cherry_pick_in_progress(struct wt_status *s, wt_status_print_trailer(s); } +static void show_revert_in_progress(struct wt_status *s, + struct wt_status_state *state, + const char *color) +{ + status_printf_ln(s, color, _("You are currently reverting a commit.")); + if (advice_status_hints) { + if (has_unmerged(s)) + status_printf_ln(s, color, + _(" (fix conflicts and run \"git revert --continue\")")); + else + status_printf_ln(s, color, + _(" (all conflicts fixed: run \"git revert --continue\")")); + status_printf_ln(s, color, + _(" (use \"git revert --abort\" to cancel the revert operation)")); + } + wt_status_print_trailer(s); +} + static void show_bisect_in_progress(struct wt_status *s, struct wt_status_state *state, const char *color) @@ -1113,6 +1131,9 @@ void wt_status_get_state(struct wt_status_state *state, state->bisect_in_progress = 1; state->branch = read_and_strip_branch("BISECT_START"); } + if (!stat(git_path("REVERT_HEAD"), &st)) { + state->revert_in_progress = 1; + } if (get_detached_from) wt_status_get_detached_from(state); @@ -1130,6 +1151,8 @@ static void wt_status_print_state(struct wt_status *s, show_rebase_in_progress(s, state, state_color); else if (state->cherry_pick_in_progress) show_cherry_pick_in_progress(s, state, state_color); + else if (state->revert_in_progress) + show_revert_in_progress(s, state, state_color); if (state->bisect_in_progress) show_bisect_in_progress(s, state, state_color); } |