From: Guillaume Pagès Date: Wed, 03 Jun 2015 22:00:24 GMT Subject: [PATCH 3/4] status: give more information during rebase -i Message-ID: <1433368825-24617-3-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr> In-Reply-To: <1433368825-24617-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr> git status gives more information during rebase -i, about the list of command that are done during the rebase. It displays the two last commands executed and the two next lines to be executed. It also gives hints to find the whole files in .git directory. --- t/t7512-status-help.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++ wt-status.c | 90 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+) diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh index 190656d..4dd201a 100755 --- a/t/t7512-status-help.sh +++ b/t/t7512-status-help.sh @@ -134,9 +134,13 @@ test_expect_success 'prepare for rebase_i_conflicts' ' test_expect_success 'status during rebase -i when conflicts unresolved' ' test_when_finished "git rebase --abort" && ONTO=$(git rev-parse --short rebase_i_conflicts) && + LAST_COMMIT=$(git rev-parse rebase_i_conflicts_second) && test_must_fail git rebase -i rebase_i_conflicts && cat >expected <expected <expected <expected <expected <expected <expected <expected <expected <expected <expected <expected <expected <expected <rebase_interactive_in_progress) { + int i, begin; + int numlines = 0; + char *lines[2]; + get_two_last_lines("rebase-merge/done", &numlines, lines); + if (numlines == 0) + status_printf_ln(s,color,_("No command done.")); + else{ + status_printf_ln(s,color, + _("Last command(s) done (%d command(s) done):"), + numlines); + begin = numlines > 1? 0 : 1; + for (i = begin; i < 2; i++) { + status_printf_ln(s,color," %s",lines[i]); + } + if (numlines > 2 && s->hints) + status_printf_ln(s,color, + _(" (see more at .git/rebase-merge/done)")); + } + numlines = 0; + get_two_first_lines("rebase-merge/git-rebase-todo", + &numlines, lines); + if (numlines == 0) + status_printf_ln(s, color, + _("No command remaining.")); + else{ + + status_printf_ln(s, color, + _("Next command(s) to do (%d remaining command(s)):"), + numlines); + begin = numlines > 1? 0 : 1; + for (i = 0; (i < 2 && i < numlines); i++) { + status_printf(s, color, " %s", lines[i]); + } + if (s->hints) + status_printf_ln(s, color, + _(" (use git rebase --edit-todo to view and edit)")); + } + } +} + static void show_rebase_in_progress(struct wt_status *s, struct wt_status_state *state, const char *color) { struct stat st; + show_rebase_information(s, state, color); if (has_unmerged(s) || state->rebase_in_progress || !stat(git_path("MERGE_MSG"), &st)) { if (state->branch) status_printf_ln(s, color, -- 2.4.2.342.g3cebd9b