From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthieu Moy Subject: [PATCH v4 3/4] status: give more information during rebase -i Date: Tue, 30 Jun 2015 15:01:14 +0200 Message-ID: <1435669275-32102-4-git-send-email-Matthieu.Moy@imag.fr> References: <1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: git@vger.kernel.org, remi.lespinet@ensimag.grenoble-inp.fr, guillaume.pages@ensimag.grenoble-inp.fr, louis--alexandre.stuber@ensimag.grenoble-inp.fr, antoine.delaite@ensimag.grenoble-inp.fr, Matthieu Moy To: gitster@pobox.com X-From: git-owner@vger.kernel.org Tue Jun 30 15:01:48 2015 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z9vAV-0005e9-Rg for gcvg-git-2@plane.gmane.org; Tue, 30 Jun 2015 15:01:44 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752972AbbF3NBf convert rfc822-to-quoted-printable (ORCPT ); Tue, 30 Jun 2015 09:01:35 -0400 Received: from mx1.imag.fr ([129.88.30.5]:41241 "EHLO shiva.imag.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbbF3NBb (ORCPT ); Tue, 30 Jun 2015 09:01:31 -0400 Received: from clopinette.imag.fr (clopinette.imag.fr [129.88.34.215]) by shiva.imag.fr (8.13.8/8.13.8) with ESMTP id t5UD1Mia029551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Jun 2015 15:01:23 +0200 Received: from anie.imag.fr (anie.imag.fr [129.88.7.32]) by clopinette.imag.fr (8.13.8/8.13.8) with ESMTP id t5UD1OwQ024079; Tue, 30 Jun 2015 15:01:24 +0200 Received: from moy by anie.imag.fr with local (Exim 4.80) (envelope-from ) id 1Z9vAC-0000CA-7g; Tue, 30 Jun 2015 15:01:24 +0200 X-Mailer: git-send-email 2.5.0.rc0.10.g7792c2a In-Reply-To: <1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (shiva.imag.fr [129.88.30.5]); Tue, 30 Jun 2015 15:01:23 +0200 (CEST) X-IMAG-MailScanner-Information: Please contact MI2S MIM for more information X-MailScanner-ID: t5UD1Mia029551 X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-SpamCheck: X-IMAG-MailScanner-From: moy@imag.fr MailScanner-NULL-Check: 1436274083.91515@GM5pc6IY7bTlHfAW53BjGg Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: =46rom: Guillaume Pag=C3=A8s 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. Signed-off-by: Guillaume Pag=C3=A8s Signed-off-by: Junio C Hamano Signed-off-by: Matthieu Moy --- t/t7512-status-help.sh | 111 +++++++++++++++++++++++++++++++++++++++++= ++++++++ wt-status.c | 63 ++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh index 190656d..0c889fa 100755 --- a/t/t7512-status-help.sh +++ b/t/t7512-status-help.sh @@ -134,9 +134,13 @@ test_expect_success 'prepare for rebase_i_conflict= s' ' test_expect_success 'status during rebase -i when conflicts unresolved= ' ' test_when_finished "git rebase --abort" && ONTO=3D$(git rev-parse --short rebase_i_conflicts) && + LAST_COMMIT=3D$(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; + int nr_lines_to_show =3D 2; + + struct strbuf buf =3D STRBUF_INIT; + struct string_list have_done =3D STRING_LIST_INIT_DUP; + struct string_list yet_to_do =3D STRING_LIST_INIT_DUP; + + strbuf_read_file(&buf, git_path("rebase-merge/done"), 0); + stripspace(&buf, 1); + string_list_split(&have_done, buf.buf, '\n', -1); + string_list_remove_empty_items(&have_done, 1); + strbuf_release(&buf); + + strbuf_read_file(&buf, git_path("rebase-merge/git-rebase-todo"), 0); + stripspace(&buf, 1); + string_list_split(&yet_to_do, buf.buf, '\n', -1); + string_list_remove_empty_items(&yet_to_do, 1); + strbuf_release(&buf); + + if (have_done.nr =3D=3D 0) + status_printf_ln(s, color, _("No commands done.")); + else { + status_printf_ln(s, color, + Q_("Last command done (%d command done):", + "Last commands done (%d commands done):", + have_done.nr), + have_done.nr); + for (i =3D (have_done.nr > nr_lines_to_show) + ? have_done.nr - nr_lines_to_show : 0; + i < have_done.nr; + i++) + status_printf_ln(s, color, " %s", have_done.items[i].string); + if (have_done.nr > nr_lines_to_show && s->hints) + status_printf_ln(s, color, + _(" (see more in file %s)"), git_path("rebase-merge/done")); + } + + if (yet_to_do.nr =3D=3D 0) + status_printf_ln(s, color, + _("No commands remaining.")); + else { + status_printf_ln(s, color, + Q_("Next command to do (%d remaining command):", + "Next commands to do (%d remaining commands):", + yet_to_do.nr), + yet_to_do.nr); + for (i =3D 0; i < nr_lines_to_show && i < yet_to_do.nr; i++) + status_printf_ln(s, color, " %s", yet_to_do.items[i].string); + if (s->hints) + status_printf_ln(s, color, + _(" (use \"git rebase --edit-todo\" to view and edit)")); + } + string_list_clear(&yet_to_do, 0); + string_list_clear(&have_done, 0); + } +} + static void print_rebase_state(struct wt_status *s, struct wt_status_state *state, const char *color) @@ -1047,6 +1109,7 @@ static void show_rebase_in_progress(struct wt_sta= tus *s, { struct stat st; =20 + show_rebase_information(s, state, color); if (has_unmerged(s)) { print_rebase_state(s, state, color); if (s->hints) { --=20 2.5.0.rc0.10.g7792c2a