{"thread":{"id":"39572","subject":"[PATCH 1/4] status: factor two rebase-related messages together","startedAt":"2015-06-09T14:42:39Z","lastAt":"2015-06-09T18:07:20Z","messageCount":7,"participants":["Guillaume Pagès","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"263361","messageId":"1433860962-13222-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","threadId":"39572","inReplyTo":null,"subject":"[PATCH 1/4] status: factor two rebase-related messages together","fromName":"Guillaume Pagès","fromEmail":"guillaume.pages@ensimag.grenoble-inp.fr","sentAt":"2015-06-09T14:42:39Z","receivedAt":"2015-06-09T14:42:39Z","isPatch":true,"sender":{"key":"guillaume.pages@ensimag.grenoble-inp.fr","avatar":null},"body":"Signed-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n---\n wt-status.c | 31 +++++++++++++++----------------\n 1 file changed, 15 insertions(+), 16 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex 33452f1..c239132 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1025,6 +1025,19 @@ static int split_commit_in_progress(struct wt_status *s)\n \tfree(rebase_orig_head);\n \treturn split_in_progress;\n }\n+static void print_rebase_state(struct wt_status *s,\n+\t\t\t\tstruct wt_status_state *state,\n+\t\t\t\tconst char *color)\n+{\n+\t\tif (state->branch)\n+\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\t\t _(\"You are currently rebasing branch '%s' on '%s'.\"),\n+\t\t\t\t\t state->branch,\n+\t\t\t\t\t state->onto);\n+\t\telse\n+\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\t\t _(\"You are currently rebasing.\"));\n+}\n \n static void show_rebase_in_progress(struct wt_status *s,\n \t\t\t\tstruct wt_status_state *state,\n@@ -1033,14 +1046,7 @@ static void show_rebase_in_progress(struct wt_status *s,\n \tstruct stat st;\n \n \tif (has_unmerged(s)) {\n-\t\tif (state->branch)\n-\t\t\tstatus_printf_ln(s, color,\n-\t\t\t\t\t _(\"You are currently rebasing branch '%s' on '%s'.\"),\n-\t\t\t\t\t state->branch,\n-\t\t\t\t\t state->onto);\n-\t\telse\n-\t\t\tstatus_printf_ln(s, color,\n-\t\t\t\t\t _(\"You are currently rebasing.\"));\n+\t\tprint_rebase_state(s, state, color);\n \t\tif (s->hints) {\n \t\t\tstatus_printf_ln(s, color,\n \t\t\t\t_(\"  (fix conflicts and then run \\\"git rebase --continue\\\")\"));\n@@ -1050,14 +1056,7 @@ static void show_rebase_in_progress(struct wt_status *s,\n \t\t\t\t_(\"  (use \\\"git rebase --abort\\\" to check out the original branch)\"));\n \t\t}\n \t} else if (state->rebase_in_progress || !stat(git_path(\"MERGE_MSG\"), &st)) {\n-\t\tif (state->branch)\n-\t\t\tstatus_printf_ln(s, color,\n-\t\t\t\t\t _(\"You are currently rebasing branch '%s' on '%s'.\"),\n-\t\t\t\t\t state->branch,\n-\t\t\t\t\t state->onto);\n-\t\telse\n-\t\t\tstatus_printf_ln(s, color,\n-\t\t\t\t\t _(\"You are currently rebasing.\"));\n+\t\tprint_rebase_state(s, state, color);\n \t\tif (s->hints)\n \t\t\tstatus_printf_ln(s, color,\n \t\t\t\t_(\"  (all conflicts fixed: run \\\"git rebase --continue\\\")\"));\n-- \n2.4.2.342.ga3499d3\n"},{"id":"263362","messageId":"1433860962-13222-2-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","threadId":"39572","inReplyTo":"1433860962-13222-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"[PATCH 2/4] status: differentiate interactive from non-interactive rebases","fromName":"Guillaume Pagès","fromEmail":"guillaume.pages@ensimag.grenoble-inp.fr","sentAt":"2015-06-09T14:42:40Z","receivedAt":"2015-06-09T14:42:40Z","isPatch":true,"sender":{"key":"guillaume.pages@ensimag.grenoble-inp.fr","avatar":null},"body":"Signed-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n---\n t/t7512-status-help.sh | 28 ++++++++++++++--------------\n wt-status.c            |  5 ++++-\n 2 files changed, 18 insertions(+), 15 deletions(-)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex 68ad2d7..190656d 100755\n--- a/t/t7512-status-help.sh\n+++ b/t/t7512-status-help.sh\n@@ -136,7 +136,7 @@ test_expect_success 'status during rebase -i when conflicts unresolved' '\n \tONTO=$(git rev-parse --short rebase_i_conflicts) &&\n \ttest_must_fail git rebase -i rebase_i_conflicts &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently rebasing branch '\\''rebase_i_conflicts_second'\\'' on '\\''$ONTO'\\''.\n   (fix conflicts and then run \"git rebase --continue\")\n   (use \"git rebase --skip\" to skip this patch)\n@@ -162,7 +162,7 @@ test_expect_success 'status during rebase -i after resolving conflicts' '\n \ttest_must_fail git rebase -i rebase_i_conflicts &&\n \tgit add main.txt &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently rebasing branch '\\''rebase_i_conflicts_second'\\'' on '\\''$ONTO'\\''.\n   (all conflicts fixed: run \"git rebase --continue\")\n \n@@ -190,7 +190,7 @@ test_expect_success 'status when rebasing -i in edit mode' '\n \tONTO=$(git rev-parse --short HEAD~2) &&\n \tgit rebase -i HEAD~2 &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''rebase_i_edit'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -216,7 +216,7 @@ test_expect_success 'status when splitting a commit' '\n \tgit rebase -i HEAD~3 &&\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently splitting a commit while rebasing branch '\\''split_commit'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -247,7 +247,7 @@ test_expect_success 'status after editing the last commit with --amend during a\n \tgit rebase -i HEAD~3 &&\n \tgit commit --amend -m \"foo\" &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''amend_last'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -277,7 +277,7 @@ test_expect_success 'status: (continue first edit) second edit' '\n \tgit rebase -i HEAD~3 &&\n \tgit rebase --continue &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -299,7 +299,7 @@ test_expect_success 'status: (continue first edit) second edit and split' '\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -326,7 +326,7 @@ test_expect_success 'status: (continue first edit) second edit and amend' '\n \tgit rebase --continue &&\n \tgit commit --amend -m \"foo\" &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -348,7 +348,7 @@ test_expect_success 'status: (amend first edit) second edit' '\n \tgit commit --amend -m \"a\" &&\n \tgit rebase --continue &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -371,7 +371,7 @@ test_expect_success 'status: (amend first edit) second edit and split' '\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -399,7 +399,7 @@ test_expect_success 'status: (amend first edit) second edit and amend' '\n \tgit rebase --continue &&\n \tgit commit --amend -m \"d\" &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -423,7 +423,7 @@ test_expect_success 'status: (split first edit) second edit' '\n \tgit commit -m \"e\" &&\n \tgit rebase --continue &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -448,7 +448,7 @@ test_expect_success 'status: (split first edit) second edit and split' '\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -478,7 +478,7 @@ test_expect_success 'status: (split first edit) second edit and amend' '\n \tgit rebase --continue &&\n \tgit commit --amend -m \"h\" &&\n \tcat >expected <<EOF &&\n-rebase in progress; onto $ONTO\n+interactive rebase in progress; onto $ONTO\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\ndiff --git a/wt-status.c b/wt-status.c\nindex c239132..2339000 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1326,7 +1326,10 @@ void wt_status_print(struct wt_status *s)\n \t\telse if (!strcmp(branch_name, \"HEAD\")) {\n \t\t\tbranch_status_color = color(WT_STATUS_NOBRANCH, s);\n \t\t\tif (state.rebase_in_progress || state.rebase_interactive_in_progress) {\n-\t\t\t\ton_what = _(\"rebase in progress; onto \");\n+\t\t\t\tif (state.rebase_interactive_in_progress)\n+\t\t\t\t\ton_what = _(\"interactive rebase in progress; onto \");\n+\t\t\t\telse\n+\t\t\t\t\ton_what = _(\"rebase in progress; onto \");\n \t\t\t\tbranch_name = state.onto;\n \t\t\t} else if (state.detached_from) {\n \t\t\t\tbranch_name = state.detached_from;\n-- \n2.4.2.342.ga3499d3\n"},{"id":"263364","messageId":"1433860962-13222-3-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","threadId":"39572","inReplyTo":"1433860962-13222-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"[PATCH 3/4] status: give more information during rebase -i","fromName":"Guillaume Pagès","fromEmail":"guillaume.pages@ensimag.grenoble-inp.fr","sentAt":"2015-06-09T14:42:41Z","receivedAt":"2015-06-09T14:42:41Z","isPatch":true,"sender":{"key":"guillaume.pages@ensimag.grenoble-inp.fr","avatar":null},"body":"git status gives more information during rebase -i, about the list of\ncommand that are done during the rebase. It displays the two last\ncommands executed and the two next lines to be executed. It also gives\nhints to find the whole files in .git directory.\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n---\n t/t7512-status-help.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++\n wt-status.c            |  64 ++++++++++++++++++++++++++++\n 2 files changed, 175 insertions(+)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex 190656d..0c889fa 100755\n--- a/t/t7512-status-help.sh\n+++ b/t/t7512-status-help.sh\n@@ -134,9 +134,13 @@ test_expect_success 'prepare for rebase_i_conflicts' '\n test_expect_success 'status during rebase -i when conflicts unresolved' '\n \ttest_when_finished \"git rebase --abort\" &&\n \tONTO=$(git rev-parse --short rebase_i_conflicts) &&\n+\tLAST_COMMIT=$(git rev-parse rebase_i_conflicts_second) &&\n \ttest_must_fail git rebase -i rebase_i_conflicts &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last command done (1 command done):\n+   pick $LAST_COMMIT one_second\n+No commands remaining.\n You are currently rebasing branch '\\''rebase_i_conflicts_second'\\'' on '\\''$ONTO'\\''.\n   (fix conflicts and then run \"git rebase --continue\")\n   (use \"git rebase --skip\" to skip this patch)\n@@ -159,10 +163,14 @@ test_expect_success 'status during rebase -i after resolving conflicts' '\n \tgit reset --hard rebase_i_conflicts_second &&\n \ttest_when_finished \"git rebase --abort\" &&\n \tONTO=$(git rev-parse --short rebase_i_conflicts) &&\n+\tLAST_COMMIT=$(git rev-parse rebase_i_conflicts_second) &&\n \ttest_must_fail git rebase -i rebase_i_conflicts &&\n \tgit add main.txt &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last command done (1 command done):\n+   pick $LAST_COMMIT one_second\n+No commands remaining.\n You are currently rebasing branch '\\''rebase_i_conflicts_second'\\'' on '\\''$ONTO'\\''.\n   (all conflicts fixed: run \"git rebase --continue\")\n \n@@ -183,7 +191,9 @@ test_expect_success 'status when rebasing -i in edit mode' '\n \tgit checkout -b rebase_i_edit &&\n \ttest_commit one_rebase_i main.txt one &&\n \ttest_commit two_rebase_i main.txt two &&\n+\tCOMMIT2=$(git rev-parse rebase_i_edit) &&\n \ttest_commit three_rebase_i main.txt three &&\n+\tCOMMIT3=$(git rev-parse rebase_i_edit) &&\n \tFAKE_LINES=\"1 edit 2\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n@@ -191,6 +201,10 @@ test_expect_success 'status when rebasing -i in edit mode' '\n \tgit rebase -i HEAD~2 &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   pick $COMMIT2 two_rebase_i\n+   edit $COMMIT3 three_rebase_i\n+No commands remaining.\n You are currently editing a commit while rebasing branch '\\''rebase_i_edit'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -207,8 +221,11 @@ test_expect_success 'status when splitting a commit' '\n \tgit checkout -b split_commit &&\n \ttest_commit one_split main.txt one &&\n \ttest_commit two_split main.txt two &&\n+\tCOMMIT2=$(git rev-parse split_commit) &&\n \ttest_commit three_split main.txt three &&\n+\tCOMMIT3=$(git rev-parse split_commit) &&\n \ttest_commit four_split main.txt four &&\n+\tCOMMIT4=$(git rev-parse split_commit) &&\n \tFAKE_LINES=\"1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n@@ -217,6 +234,12 @@ test_expect_success 'status when splitting a commit' '\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   pick $COMMIT2 two_split\n+   edit $COMMIT3 three_split\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_split\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently splitting a commit while rebasing branch '\\''split_commit'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -239,7 +262,9 @@ test_expect_success 'status after editing the last commit with --amend during a\n \ttest_commit one_amend main.txt one &&\n \ttest_commit two_amend main.txt two &&\n \ttest_commit three_amend main.txt three &&\n+\tCOMMIT3=$(git rev-parse amend_last) &&\n \ttest_commit four_amend main.txt four &&\n+\tCOMMIT4=$(git rev-parse amend_last) &&\n \tFAKE_LINES=\"1 2 edit 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n@@ -248,6 +273,11 @@ test_expect_success 'status after editing the last commit with --amend during a\n \tgit commit --amend -m \"foo\" &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (3 commands done):\n+   pick $COMMIT3 three_amend\n+   edit $COMMIT4 four_amend\n+  (see more in file .git/rebase-merge/done)\n+No commands remaining.\n You are currently editing a commit while rebasing branch '\\''amend_last'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -273,11 +303,20 @@ test_expect_success 'status: (continue first edit) second edit' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit rebase --continue &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -294,12 +333,21 @@ test_expect_success 'status: (continue first edit) second edit and split' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -321,12 +369,21 @@ test_expect_success 'status: (continue first edit) second edit and amend' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit rebase --continue &&\n \tgit commit --amend -m \"foo\" &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -343,12 +400,21 @@ test_expect_success 'status: (amend first edit) second edit' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit commit --amend -m \"a\" &&\n \tgit rebase --continue &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -366,12 +432,21 @@ test_expect_success 'status: (amend first edit) second edit and split' '\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tgit rebase -i HEAD~3 &&\n \tgit commit --amend -m \"b\" &&\n \tgit rebase --continue &&\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -393,6 +468,9 @@ test_expect_success 'status: (amend first edit) second edit and amend' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit commit --amend -m \"c\" &&\n@@ -400,6 +478,12 @@ test_expect_success 'status: (amend first edit) second edit and amend' '\n \tgit commit --amend -m \"d\" &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -416,6 +500,9 @@ test_expect_success 'status: (split first edit) second edit' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit reset HEAD^ &&\n@@ -424,6 +511,12 @@ test_expect_success 'status: (split first edit) second edit' '\n \tgit rebase --continue &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\n@@ -440,6 +533,9 @@ test_expect_success 'status: (split first edit) second edit and split' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit reset HEAD^ &&\n@@ -449,6 +545,12 @@ test_expect_success 'status: (split first edit) second edit and split' '\n \tgit reset HEAD^ &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently splitting a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (Once your working directory is clean, run \"git rebase --continue\")\n \n@@ -470,6 +572,9 @@ test_expect_success 'status: (split first edit) second edit and amend' '\n \tFAKE_LINES=\"edit 1 edit 2 3\" &&\n \texport FAKE_LINES &&\n \ttest_when_finished \"git rebase --abort\" &&\n+\tCOMMIT2=$(git rev-parse several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse several_edits^) &&\n+\tCOMMIT4=$(git rev-parse several_edits) &&\n \tONTO=$(git rev-parse --short HEAD~3) &&\n \tgit rebase -i HEAD~3 &&\n \tgit reset HEAD^ &&\n@@ -479,6 +584,12 @@ test_expect_success 'status: (split first edit) second edit and amend' '\n \tgit commit --amend -m \"h\" &&\n \tcat >expected <<EOF &&\n interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   edit $COMMIT2 two_edits\n+   edit $COMMIT3 three_edits\n+Next command to do (1 remaining command):\n+   pick $COMMIT4 four_edits\n+  (use \"git rebase --edit-todo\" to view and edit)\n You are currently editing a commit while rebasing branch '\\''several_edits'\\'' on '\\''$ONTO'\\''.\n   (use \"git commit --amend\" to amend the current commit)\n   (use \"git rebase --continue\" once you are satisfied with your changes)\ndiff --git a/wt-status.c b/wt-status.c\nindex 2339000..8b6d29c 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1025,6 +1025,69 @@ static int split_commit_in_progress(struct wt_status *s)\n \tfree(rebase_orig_head);\n \treturn split_in_progress;\n }\n+\n+static void show_rebase_information(struct wt_status *s,\n+\t\t\t\t\tstruct wt_status_state *state,\n+\t\t\t\t\tconst char *color)\n+{\n+\tif (state->rebase_interactive_in_progress) {\n+\t\tint i;\n+\t\tint nr_lines_to_show = 2;\n+\n+\t\tstruct strbuf buf = STRBUF_INIT;\n+\t\tstruct string_list have_done = STRING_LIST_INIT_DUP;\n+\t\tstruct string_list yet_to_do = STRING_LIST_INIT_DUP;\n+\n+\t\tstrbuf_read_file(&buf, git_path(\"rebase-merge/done\"), 0);\n+\t\tstripspace(&buf, 1);\n+\t\tstring_list_split(&have_done, buf.buf, '\\n', -1);\n+\t\tstring_list_remove_empty_items(&have_done, 1);\n+\t\tstrbuf_release(&buf);\n+\n+\t\tstrbuf_read_file(&buf, git_path(\"rebase-merge/git-rebase-todo\"), 0);\n+\t\tstripspace(&buf, 1);\n+\t\tstring_list_split(&yet_to_do, buf.buf, '\\n', -1);\n+\t\tstring_list_remove_empty_items(&yet_to_do, 1);\n+\t\tstrbuf_release(&buf);\n+\n+\t\tif (have_done.nr == 0)\n+\t\t\tstatus_printf_ln(s, color, _(\"No commands done.\"));\n+\t\telse {\n+\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\tQ_(\"Last command done (%d command done):\",\n+\t\t\t\t\t\"Last commands done (%d commands done):\",\n+\t\t\t\t\thave_done.nr),\n+\t\t\t\thave_done.nr);\n+\t\t\tfor (i = (have_done.nr > nr_lines_to_show)\n+\t\t\t\t? have_done.nr - nr_lines_to_show : 0;\n+\t\t\t\ti < have_done.nr;\n+\t\t\t\ti++)\n+\t\t\t\tstatus_printf_ln(s, color, \"   %s\", have_done.items[i].string);\n+\t\t\tif (have_done.nr > nr_lines_to_show && s->hints)\n+\t\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\t\t_(\"  (see more in file %s)\"), git_path(\"rebase-merge/done\"));\n+\t\t}\n+\n+\t\tif (yet_to_do.nr == 0)\n+\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\t\t _(\"No commands remaining.\"));\n+\t\telse {\n+\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\tQ_(\"Next command to do (%d remaining command):\",\n+\t\t\t\t\t\"Next commands to do (%d remaining commands):\",\n+\t\t\t\t\tyet_to_do.nr),\n+\t\t\t\tyet_to_do.nr);\n+\t\t\tfor (i = 0; i < nr_lines_to_show && i < yet_to_do.nr; i++)\n+\t\t\t\tstatus_printf_ln(s, color, \"   %s\", yet_to_do.items[i].string);\n+\t\t\tif (s->hints)\n+\t\t\t\tstatus_printf_ln(s, color,\n+\t\t\t\t\t_(\"  (use \\\"git rebase --edit-todo\\\" to view and edit)\"));\n+\t\t}\n+\t\tstring_list_clear(&yet_to_do, 0);\n+\t\tstring_list_clear(&have_done, 0);\n+\t}\n+}\n+\n static void print_rebase_state(struct wt_status *s,\n \t\t\t\tstruct wt_status_state *state,\n \t\t\t\tconst char *color)\n@@ -1045,6 +1108,7 @@ static void show_rebase_in_progress(struct wt_status *s,\n {\n \tstruct stat st;\n \n+\tshow_rebase_information(s, state, color);\n \tif (has_unmerged(s)) {\n \t\tprint_rebase_state(s, state, color);\n \t\tif (s->hints) {\n-- \n2.4.2.342.ga3499d3\n"},{"id":"263363","messageId":"1433860962-13222-4-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","threadId":"39572","inReplyTo":"1433860962-13222-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"[PATCH 4/4] status: add new tests for status during rebase -i","fromName":"Guillaume Pagès","fromEmail":"guillaume.pages@ensimag.grenoble-inp.fr","sentAt":"2015-06-09T14:42:42Z","receivedAt":"2015-06-09T14:42:42Z","isPatch":true,"sender":{"key":"guillaume.pages@ensimag.grenoble-inp.fr","avatar":null},"body":"Expand test coverage with one or more than two commands done\nand with zero, one or more than two commands remaining.\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n---\n t/t7512-status-help.sh | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 87 insertions(+)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex 0c889fa..cbe27f9 100755\n--- a/t/t7512-status-help.sh\n+++ b/t/t7512-status-help.sh\n@@ -856,4 +856,91 @@ EOF\n \ttest_i18ncmp expected actual\n '\n \n+test_expect_success 'prepare for different number of commits rebased' '\n+\tgit reset --hard master &&\n+\tgit checkout -b several_commits &&\n+\ttest_commit one_commit main.txt one &&\n+\ttest_commit two_commit main.txt two &&\n+\ttest_commit three_commit main.txt three &&\n+\ttest_commit four_commit main.txt four\n+'\n+\n+test_expect_success 'status: one command done nothing remaining' '\n+\tFAKE_LINES=\"exec_exit_15\" &&\n+\texport FAKE_LINES &&\n+\ttest_when_finished \"git rebase --abort\" &&\n+\tONTO=$(git rev-parse --short HEAD~3) &&\n+\ttest_must_fail git rebase -i HEAD~3 &&\n+\tcat >expected <<EOF &&\n+interactive rebase in progress; onto $ONTO\n+Last command done (1 command done):\n+   exec exit 15\n+No commands remaining.\n+You are currently editing a commit while rebasing branch '\\''several_commits'\\'' on '\\''$ONTO'\\''.\n+  (use \"git commit --amend\" to amend the current commit)\n+  (use \"git rebase --continue\" once you are satisfied with your changes)\n+\n+nothing to commit (use -u to show untracked files)\n+EOF\n+\tgit status --untracked-files=no >actual &&\n+\ttest_i18ncmp expected actual\n+'\n+\n+test_expect_success 'status: two commands done with some white lines in done file' '\n+\tFAKE_LINES=\"1 > exec_exit_15  2 3\" &&\n+\texport FAKE_LINES &&\n+\ttest_when_finished \"git rebase --abort\" &&\n+\tONTO=$(git rev-parse --short HEAD~3) &&\n+\tCOMMIT4=$(git rev-parse HEAD) &&\n+\tCOMMIT3=$(git rev-parse HEAD^) &&\n+\tCOMMIT2=$(git rev-parse HEAD^^) &&\n+\ttest_must_fail git rebase -i HEAD~3 &&\n+\tcat >expected <<EOF &&\n+interactive rebase in progress; onto $ONTO\n+Last commands done (2 commands done):\n+   pick $COMMIT2 two_commit\n+   exec exit 15\n+Next commands to do (2 remaining commands):\n+   pick $COMMIT3 three_commit\n+   pick $COMMIT4 four_commit\n+  (use \"git rebase --edit-todo\" to view and edit)\n+You are currently editing a commit while rebasing branch '\\''several_commits'\\'' on '\\''$ONTO'\\''.\n+  (use \"git commit --amend\" to amend the current commit)\n+  (use \"git rebase --continue\" once you are satisfied with your changes)\n+\n+nothing to commit (use -u to show untracked files)\n+EOF\n+\tgit status --untracked-files=no >actual &&\n+\ttest_i18ncmp expected actual\n+'\n+\n+test_expect_success 'status: two remaining commands with some white lines in todo file' '\n+\tFAKE_LINES=\"1 2 exec_exit_15 3 > 4\" &&\n+\texport FAKE_LINES &&\n+\ttest_when_finished \"git rebase --abort\" &&\n+\tONTO=$(git rev-parse --short HEAD~4) &&\n+\tCOMMIT4=$(git rev-parse HEAD) &&\n+\tCOMMIT3=$(git rev-parse HEAD^) &&\n+\tCOMMIT2=$(git rev-parse HEAD^^) &&\n+\ttest_must_fail git rebase -i HEAD~4 &&\n+\tcat >expected <<EOF &&\n+interactive rebase in progress; onto $ONTO\n+Last commands done (3 commands done):\n+   pick $COMMIT2 two_commit\n+   exec exit 15\n+  (see more in file .git/rebase-merge/done)\n+Next commands to do (2 remaining commands):\n+   pick $COMMIT3 three_commit\n+   pick $COMMIT4 four_commit\n+  (use \"git rebase --edit-todo\" to view and edit)\n+You are currently editing a commit while rebasing branch '\\''several_commits'\\'' on '\\''$ONTO'\\''.\n+  (use \"git commit --amend\" to amend the current commit)\n+  (use \"git rebase --continue\" once you are satisfied with your changes)\n+\n+nothing to commit (use -u to show untracked files)\n+EOF\n+\tgit status --untracked-files=no >actual &&\n+\ttest_i18ncmp expected actual\n+'\n+\n test_done\n-- \n2.4.2.342.ga3499d3\n"},{"id":"263367","messageId":"vpqk2vd3ozx.fsf@anie.imag.fr","threadId":"39572","inReplyTo":"1433860962-13222-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 1/4] status: factor two rebase-related messages together","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-09T15:01:06Z","receivedAt":"2015-06-09T15:01:06Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:\n\n> Signed-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n> ---\n>  wt-status.c | 31 +++++++++++++++----------------\n>  1 file changed, 15 insertions(+), 16 deletions(-)\n>\n> diff --git a/wt-status.c b/wt-status.c\n> index 33452f1..c239132 100644\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -1025,6 +1025,19 @@ static int split_commit_in_progress(struct wt_status *s)\n>  \tfree(rebase_orig_head);\n>  \treturn split_in_progress;\n>  }\n> +static void print_rebase_state(struct wt_status *s,\n\nPlease, skip a line between functions.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"263368","messageId":"vpqbngp3oxy.fsf@anie.imag.fr","threadId":"39572","inReplyTo":"1433860962-13222-2-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 2/4] status: differentiate interactive from non-interactive rebases","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-09T15:02:17Z","receivedAt":"2015-06-09T15:02:17Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:\n\n> Signed-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n> ---\n>  t/t7512-status-help.sh | 28 ++++++++++++++--------------\n>  wt-status.c            |  5 ++++-\n\nAre there any change since the last version? Please, help reviewers by\nanticipating this question and versionning your patches ([PATCH v3 2/4]\nin the subject, git send-email -v3 does this for you).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"263398","messageId":"xmqqy4js7o2v.fsf@gitster.dls.corp.google.com","threadId":"39572","inReplyTo":"vpqbngp3oxy.fsf@anie.imag.fr","subject":"Re: [PATCH 2/4] status: differentiate interactive from non-interactive rebases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-09T18:07:20Z","receivedAt":"2015-06-09T18:07:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:\n>\n>> Signed-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n>> ---\n>>  t/t7512-status-help.sh | 28 ++++++++++++++--------------\n>>  wt-status.c            |  5 ++++-\n>\n> Are there any change since the last version? Please, help reviewers by\n> anticipating this question and versionning your patches ([PATCH v3 2/4]\n> in the subject, git send-email -v3 does this for you).\n\nPlus, it would help to say something like \"no changes since v2\"\nafter that three-dash line before the diffstat graph.\n\nThanks.\n"}]}