{"thread":{"id":"39754","subject":"[PATCH v4 1/4] status: factor two rebase-related messages together","startedAt":"2015-06-30T13:01:11Z","lastAt":"2015-07-08T07:10:40Z","messageCount":26,"participants":["Matthieu Moy","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":4,"patchTotal":4},"messages":[{"id":"265226","messageId":"1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":null,"subject":"[PATCH v4 0/4] More helpful 'git status' during 'rebase -i'","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-06-30T13:01:11Z","receivedAt":"2015-06-30T13:01:11Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"This series makes \"git status\" provide an output like\n\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\nin addition to the existing output, when ran during an interactive\nrebase.\n\nPrevious version here:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/271184\n\nI just fixed the missing newline I noticed, and squashed Junio's\nindentation fix. These were the only two remarks on the last\niteration.\n\nGuillaume Pagès (4):\n  status: factor two rebase-related messages together\n  status: differentiate interactive from non-interactive rebases\n  status: give more information during rebase -i\n  status: add new tests for status during rebase -i\n\n t/t7512-status-help.sh | 226 ++++++++++++++++++++++++++++++++++++++++++++++---\n wt-status.c            | 100 ++++++++++++++++++----\n 2 files changed, 295 insertions(+), 31 deletions(-)\n\n-- \n2.5.0.rc0.10.g7792c2a\n"},{"id":"265225","messageId":"1435669275-32102-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v4 1/4] status: factor two rebase-related messages together","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-06-30T13:01:12Z","receivedAt":"2015-06-30T13:01:12Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n wt-status.c | 32 ++++++++++++++++----------------\n 1 file changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex eaed4fe..8c4b806 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1027,6 +1027,20 @@ static int split_commit_in_progress(struct wt_status *s)\n \treturn split_in_progress;\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+{\n+\tif (state->branch)\n+\t\tstatus_printf_ln(s, color,\n+\t\t\t\t _(\"You are currently rebasing branch '%s' on '%s'.\"),\n+\t\t\t\t state->branch,\n+\t\t\t\t state->onto);\n+\telse\n+\t\tstatus_printf_ln(s, color,\n+\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 \t\t\t\tconst char *color)\n@@ -1034,14 +1048,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@@ -1051,14 +1058,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.5.0.rc0.10.g7792c2a\n"},{"id":"265227","messageId":"1435669275-32102-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v4 2/4] status: differentiate interactive from non-interactive rebases","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-06-30T13:01:13Z","receivedAt":"2015-06-30T13:01:13Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.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 8c4b806..81610dc 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1328,7 +1328,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.5.0.rc0.10.g7792c2a\n"},{"id":"265229","messageId":"1435669275-32102-4-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v4 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-06-30T13:01:14Z","receivedAt":"2015-06-30T13:01:14Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\ngit 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n t/t7512-status-help.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++\n wt-status.c            |  63 ++++++++++++++++++++++++++++\n 2 files changed, 174 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 81610dc..9c686e6 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1027,6 +1027,68 @@ static int split_commit_in_progress(struct wt_status *s)\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@@ -1047,6 +1109,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.5.0.rc0.10.g7792c2a\n"},{"id":"265228","messageId":"1435669275-32102-5-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v4 4/4] status: add new tests for status during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-06-30T13:01:15Z","receivedAt":"2015-06-30T13:01:15Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nExpand 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.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.5.0.rc0.10.g7792c2a\n"},{"id":"265280","messageId":"xmqqpp4cbxz6.fsf@gitster.dls.corp.google.com","threadId":"39754","inReplyTo":"1435669275-32102-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH v4 0/4] More helpful 'git status' during 'rebase -i'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-30T23:03:25Z","receivedAt":"2015-06-30T23:03:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> This series makes \"git status\" provide an output like\n>\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>\n> in addition to the existing output, when ran during an interactive\n> rebase.\n\nI'd prefer to see these $COMMITn abbreviated, just like $ONTO.  Look\nwhat I just got while squashing two adjacent patches ;-)\n\n# interactive rebase in progress; onto a04bfc2\n# Last commands done (2 commands done):\n#    pick c186b073f46a3298f2e6f63a8c1becb07bedc4f0 rerere: explain what 'want_sp' does to is_cmarker\n#    squash 17c5b40b46c0e171ed49907e6cb91c2a1d7f7113 rerere: drop want_sp parameter from is_cmarker()\n# Next commands to do (3 remaining commands):\n#    pick 8fc64c4c1024006e71cf0b6c2e3d0ad403f263f8 t4200: rerere a merge with two identical conflicts\n#    pick 094950cdc51599f6fec1b1c0098816888a648bf8 rerere: document internal I/O abstraction\n# You are currently editing a commit while rebasing branch 'jc/rerere' on 'a04bfc2'.\n"},{"id":"265305","messageId":"vpq7fqkz48f.fsf@anie.imag.fr","threadId":"39754","inReplyTo":"xmqqpp4cbxz6.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v4 0/4] More helpful 'git status' during 'rebase -i'","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-07-01T08:12:00Z","receivedAt":"2015-07-01T08:12:00Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> This series makes \"git status\" provide an output like\n>>\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>>\n>> in addition to the existing output, when ran during an interactive\n>> rebase.\n>\n> I'd prefer to see these $COMMITn abbreviated, just like $ONTO.\n\nIndeed. It's not as easy as it would seem because we're in wt-status.c\nand can't call a shell function like collapse_todo_ids directly, but\nI've re-implemented it in C, it's not that bad.\n\nPatch follows. The first two patches are unchanged. wt-status.c now\nabbreviates the sha1, and the tests are adapted (rev-parse -> rev-parse\n--short) where needed in patch 3 and 4.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"265307","messageId":"1435739433-18853-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"vpq7fqkz48f.fsf@anie.imag.fr","subject":"[PATCH v5 1/4] status: factor two rebase-related messages together","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T08:30:30Z","receivedAt":"2015-07-01T08:30:30Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nNo change since v4.\n\n wt-status.c | 32 ++++++++++++++++----------------\n 1 file changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex eaed4fe..8c4b806 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1027,6 +1027,20 @@ static int split_commit_in_progress(struct wt_status *s)\n \treturn split_in_progress;\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+{\n+\tif (state->branch)\n+\t\tstatus_printf_ln(s, color,\n+\t\t\t\t _(\"You are currently rebasing branch '%s' on '%s'.\"),\n+\t\t\t\t state->branch,\n+\t\t\t\t state->onto);\n+\telse\n+\t\tstatus_printf_ln(s, color,\n+\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 \t\t\t\tconst char *color)\n@@ -1034,14 +1048,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@@ -1051,14 +1058,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.5.0.rc0.7.ge1edd74\n"},{"id":"265306","messageId":"1435739433-18853-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435739433-18853-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v5 2/4] status: differentiate interactive from non-interactive rebases","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T08:30:31Z","receivedAt":"2015-07-01T08:30:31Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nNo change since v4.\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 8c4b806..81610dc 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1328,7 +1328,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.5.0.rc0.7.ge1edd74\n"},{"id":"265308","messageId":"1435739433-18853-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435739433-18853-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v5 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T08:30:32Z","receivedAt":"2015-07-01T08:30:32Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\ngit 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nAdded sha1-shortening code.\n\n t/t7512-status-help.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++\n wt-status.c            | 109 ++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 220 insertions(+)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex 190656d..9be0235 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 --short 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 --short 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 --short rebase_i_edit) &&\n \ttest_commit three_rebase_i main.txt three &&\n+\tCOMMIT3=$(git rev-parse --short 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 --short split_commit) &&\n \ttest_commit three_split main.txt three &&\n+\tCOMMIT3=$(git rev-parse --short split_commit) &&\n \ttest_commit four_split main.txt four &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short amend_last) &&\n \ttest_commit four_amend main.txt four &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 81610dc..005a558 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1027,6 +1027,114 @@ static int split_commit_in_progress(struct wt_status *s)\n \treturn split_in_progress;\n }\n \n+/*\n+ * Turn\n+ * pick d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some message\n+ * into\n+ * pick d6a2f03 some message\n+ */\n+static void abbrev_sha1_in_line(struct strbuf *line)\n+{\n+\tstruct strbuf **split;\n+\tint i;\n+\n+\tif (starts_with(line->buf, \"exec \") ||\n+\t    starts_with(line->buf, \"x \"))\n+\t\treturn;\n+\n+\tsplit = strbuf_split_max(line, ' ', 3);\n+\tif (split[0] && split[1]) {\n+\t\tunsigned char sha1[20];\n+\t\tconst char *abbrev;\n+\n+\t\t/*\n+\t\t * strbuf_split_max left a space. Trim it and re-add\n+\t\t * it after abbreviation.\n+\t\t */\n+\t\tstrbuf_trim(split[1]);\n+\t\tif (!get_sha1(split[1]->buf, sha1)) {\n+\t\t\tabbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n+\t\t\tstrbuf_reset(split[1]);\n+\t\t\tstrbuf_addf(split[1], \"%s \", abbrev);\n+\t\t}\n+\t\tstrbuf_reset(line);\n+\t\tfor (i = 0; split[i]; i++)\n+\t\t\tstrbuf_addstr(line, split[i]->buf);\n+\t}\n+\tfor (i = 0; split[i]; i++)\n+\t\tstrbuf_release(split[i]);\n+\n+}\n+\n+static void read_rebase_todolist(const char *fname, struct string_list *lines)\n+{\n+\tstruct strbuf line = STRBUF_INIT;\n+\tFILE *f = fopen(git_path(fname), \"r\");\n+\n+\tif (!f)\n+\t\tdie_errno(\"Could not open file %s for reading\", git_path(fname));\n+\twhile (!strbuf_getline(&line, f, '\\n')) {\n+\t\tstripspace(&line, 1);\n+\t\t/* Remove trailing \\n */\n+\t\tstrbuf_rtrim(&line);\n+\t\tabbrev_sha1_in_line(&line);\n+\t\tstring_list_append(lines, line.buf);\n+\t}\n+\tstring_list_remove_empty_items(lines, 1);\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 string_list have_done = STRING_LIST_INIT_DUP;\n+\t\tstruct string_list yet_to_do = STRING_LIST_INIT_DUP;\n+\n+\t\tread_rebase_todolist(\"rebase-merge/done\", &have_done);\n+\t\tread_rebase_todolist(\"rebase-merge/git-rebase-todo\", &yet_to_do);\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@@ -1047,6 +1155,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.5.0.rc0.7.ge1edd74\n"},{"id":"265309","messageId":"1435739433-18853-4-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435739433-18853-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v5 4/4] status: add new tests for status during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T08:30:33Z","receivedAt":"2015-07-01T08:30:33Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nExpand 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nAdded --short where appropriate.\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 9be0235..49d19a3 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 --short HEAD) &&\n+\tCOMMIT3=$(git rev-parse --short HEAD^) &&\n+\tCOMMIT2=$(git rev-parse --short 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 --short HEAD) &&\n+\tCOMMIT3=$(git rev-parse --short HEAD^) &&\n+\tCOMMIT2=$(git rev-parse --short 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.5.0.rc0.7.ge1edd74\n"},{"id":"265325","messageId":"xmqq4mlnc0lr.fsf@gitster.dls.corp.google.com","threadId":"39754","inReplyTo":"1435739433-18853-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-01T16:18:56Z","receivedAt":"2015-07-01T16:18:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> +/*\n> + * Turn\n> + * pick d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some message\n> + * into\n> + * pick d6a2f03 some message\n> + */\n> +static void abbrev_sha1_in_line(struct strbuf *line)\n> +{\n> +\tstruct strbuf **split;\n> +\tint i;\n> +\n> +\tif (starts_with(line->buf, \"exec \") ||\n> +\t    starts_with(line->buf, \"x \"))\n> +\t\treturn;\n> +\n> +\tsplit = strbuf_split_max(line, ' ', 3);\n> +\tif (split[0] && split[1]) {\n> +\t\tunsigned char sha1[20];\n> +\t\tconst char *abbrev;\n> +\n> +\t\t/*\n> +\t\t * strbuf_split_max left a space. Trim it and re-add\n> +\t\t * it after abbreviation.\n> +\t\t */\n> +\t\tstrbuf_trim(split[1]);\n> +\t\tif (!get_sha1(split[1]->buf, sha1)) {\n> +\t\t\tabbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n> +\t\t\tstrbuf_reset(split[1]);\n> +\t\t\tstrbuf_addf(split[1], \"%s \", abbrev);\n> +\t\t}\n\n... else?\n\nThat is, \"we thought there would be a full SHA-1, but it turns out\nthat there wasn't, so we keep split[1] as-is\" would need to add the\nspace back, no?  Perhaps be more strict and do this instead (without\nleading strbuf_trim):\n\n\tif (!get_sha1_hex(split[1]->buf, sha1) &&\n\t    !strcmp(split[1]->buf + 40, \" \") {\n\t\treplace split[1] with \"%s \" abbrev\n\t}\n\n> +\t\tstrbuf_reset(line);\n> +\t\tfor (i = 0; split[i]; i++)\n> +\t\t\tstrbuf_addstr(line, split[i]->buf);\n> +\t}\n> +\tfor (i = 0; split[i]; i++)\n> +\t\tstrbuf_release(split[i]);\n> +\n> +}\n> +\n> +static void read_rebase_todolist(const char *fname, struct string_list *lines)\n> +{\n> +\tstruct strbuf line = STRBUF_INIT;\n> +\tFILE *f = fopen(git_path(fname), \"r\");\n> +\n> +\tif (!f)\n> +\t\tdie_errno(\"Could not open file %s for reading\", git_path(fname));\n> +\twhile (!strbuf_getline(&line, f, '\\n')) {\n> +\t\tstripspace(&line, 1);\n\nstripspace() is meant to be used for multi-line input (e.g. it\ncollapses a multi-line paragraph break into one blank line) and it\ndoes not look a good fit in a loop that goes line-by-line. As you\ncall (and you have to, because stripspace() fixes the incomplete\nline by adding LF at the end) rtrim() immediately afterward, this\ncall is done only for removing comments (in other words, trailing\nwhitespaces are removed without the call to stripspace() anyway).\n\n> +\t\t/* Remove trailing \\n */\n> +\t\tstrbuf_rtrim(&line);\n> +\t\tabbrev_sha1_in_line(&line);\n> +\t\tstring_list_append(lines, line.buf);\n> +\t}\n> +\tstring_list_remove_empty_items(lines, 1);\n> +}\n\nPerhaps\n\n        while (!strbuf_getline(&line, f, '\\n')) {\n                if (line.len && line.len[0] == comment_line_char)\n                        continue;\n                strbuf_rtrim(&line);\n                if (!line.len)\n                        continue;\n                abbrev_sha1_in_line(&line);\n                string_list_append(lines, line.buf);\n        }\n\nwithout the \"we may have added cruft, so discard them at the end\"?\n\nOther than these two minor nits, I didn't spot anything questionable\nin the diff between this and the previous round.\n\nThanks.\n"},{"id":"265327","messageId":"CAPig+cSXzN84C4tOi5oZaK_1UJGcNXywE_-V7CyDQUMXox1Acw@mail.gmail.com","threadId":"39754","inReplyTo":"xmqq4mlnc0lr.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-01T16:33:03Z","receivedAt":"2015-07-01T16:33:03Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Jul 1, 2015 at 12:18 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>> +/*\n>> + * Turn\n>> + * pick d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some message\n>> + * into\n>> + * pick d6a2f03 some message\n>> + */\n>> +static void abbrev_sha1_in_line(struct strbuf *line)\n>> +{\n>> +     struct strbuf **split;\n>> +     int i;\n>> +\n>> +     if (starts_with(line->buf, \"exec \") ||\n>> +         starts_with(line->buf, \"x \"))\n>> +             return;\n>> +\n>> +     split = strbuf_split_max(line, ' ', 3);\n>> +     if (split[0] && split[1]) {\n>> +             unsigned char sha1[20];\n>> +             const char *abbrev;\n>> +\n>> +             /*\n>> +              * strbuf_split_max left a space. Trim it and re-add\n>> +              * it after abbreviation.\n>> +              */\n>> +             strbuf_trim(split[1]);\n>> +             if (!get_sha1(split[1]->buf, sha1)) {\n>> +                     abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n>> +                     strbuf_reset(split[1]);\n>> +                     strbuf_addf(split[1], \"%s \", abbrev);\n>> +             }\n>\n> ... else?\n>\n> That is, \"we thought there would be a full SHA-1, but it turns out\n> that there wasn't, so we keep split[1] as-is\" would need to add the\n> space back, no?\n\nI was about to mention the same shortcoming, but you beat me to it.\n\n> Perhaps be more strict and do this instead (without\n> leading strbuf_trim):\n>\n>         if (!get_sha1_hex(split[1]->buf, sha1) &&\n>             !strcmp(split[1]->buf + 40, \" \") {\n>                 replace split[1] with \"%s \" abbrev\n>         }\n\nIsn't it dangerous to assume that you can index 40 characters into\nsplit[1]? If (for some reason), the user botched the todo line such\nthat the SHA1 is no longer a valid hex string, then split[1] will be\nthat botched string, which might be shorter than 40 characters. For\ninstance, if the user-edited todo line is:\n\n    pick oops nothing\n\nthen git-rebase--interactive.sh:transform_todo_ids() will leave \"oops\"\nas-is, since it can't unabbreviate it, and then this code will place\n\"oops\" into split[1].\n"},{"id":"265328","messageId":"xmqqvbe3al87.fsf@gitster.dls.corp.google.com","threadId":"39754","inReplyTo":"CAPig+cSXzN84C4tOi5oZaK_1UJGcNXywE_-V7CyDQUMXox1Acw@mail.gmail.com","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-01T16:36:24Z","receivedAt":"2015-07-01T16:36:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> I was about to mention the same shortcoming, but you beat me to it.\n>\n>> Perhaps be more strict and do this instead (without\n>> leading strbuf_trim):\n>>\n>>         if (!get_sha1_hex(split[1]->buf, sha1) &&\n>>             !strcmp(split[1]->buf + 40, \" \") {\n>>                 replace split[1] with \"%s \" abbrev\n>>         }\n>\n> Isn't it dangerous to assume that you can index 40 characters into\n> split[1]? If (for some reason), the user botched the todo line such\n> that the SHA1 is no longer a valid hex string, then split[1] will be\n> that botched string, which might be shorter than 40 characters. For\n> instance, if the user-edited todo line is:\n>\n>     pick oops nothing\n>\n> then git-rebase--interactive.sh:transform_todo_ids() will leave \"oops\"\n> as-is, since it can't unabbreviate it, and then this code will place\n> \"oops\" into split[1].\n\nYeah, that is why get_sha1_hex() is checked before we try to make\nsure buf[40] has \" \" in the code snippet you quoted.\n\nIsn't that how && short-cut works?\n"},{"id":"265329","messageId":"CAPig+cTAQ8UkymNdp6_rwhs=7LOG7SiHmdhMX79GSu9NZ6g2cw@mail.gmail.com","threadId":"39754","inReplyTo":"xmqqvbe3al87.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-01T16:37:44Z","receivedAt":"2015-07-01T16:37:44Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Jul 1, 2015 at 12:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>\n>> I was about to mention the same shortcoming, but you beat me to it.\n>>\n>>> Perhaps be more strict and do this instead (without\n>>> leading strbuf_trim):\n>>>\n>>>         if (!get_sha1_hex(split[1]->buf, sha1) &&\n>>>             !strcmp(split[1]->buf + 40, \" \") {\n>>>                 replace split[1] with \"%s \" abbrev\n>>>         }\n>>\n>> Isn't it dangerous to assume that you can index 40 characters into\n>> split[1]? If (for some reason), the user botched the todo line such\n>> that the SHA1 is no longer a valid hex string, then split[1] will be\n>> that botched string, which might be shorter than 40 characters. For\n>> instance, if the user-edited todo line is:\n>>\n>>     pick oops nothing\n>>\n>> then git-rebase--interactive.sh:transform_todo_ids() will leave \"oops\"\n>> as-is, since it can't unabbreviate it, and then this code will place\n>> \"oops\" into split[1].\n>\n> Yeah, that is why get_sha1_hex() is checked before we try to make\n> sure buf[40] has \" \" in the code snippet you quoted.\n>\n> Isn't that how && short-cut works?\n\nArgh, I misread the code. Sorry for the noise.\n"},{"id":"265367","messageId":"vpqk2ujoadw.fsf@anie.imag.fr","threadId":"39754","inReplyTo":"xmqq4mlnc0lr.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-07-01T21:06:51Z","receivedAt":"2015-07-01T21:06:51Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> +\t\tstrbuf_trim(split[1]);\n>> +\t\tif (!get_sha1(split[1]->buf, sha1)) {\n>> +\t\t\tabbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n>> +\t\t\tstrbuf_reset(split[1]);\n>> +\t\t\tstrbuf_addf(split[1], \"%s \", abbrev);\n>> +\t\t}\n>\n> ... else?\n>\n> That is, \"we thought there would be a full SHA-1, but it turns out\n> that there wasn't, so we keep split[1] as-is\" would need to add the\n> space back, no?\n\nRight.\n\n> Perhaps be more strict and do this instead (without leading\n> strbuf_trim):\n>\n> \tif (!get_sha1_hex(split[1]->buf, sha1) &&\n> \t    !strcmp(split[1]->buf + 40, \" \") {\n> \t\treplace split[1] with \"%s \" abbrev\n> \t}\n\nActually, we can do simpler: we still have the original line available,\nso if we don't find a sha1, we can just keep it. By just letting the few\nlines after the if enter the if, it just works:\n\n\t\tstrbuf_trim(split[1]);\n\t\tif (!get_sha1(split[1]->buf, sha1)) {\n\t\t\tabbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n\t\t\tstrbuf_reset(split[1]);\n\t\t\tstrbuf_addf(split[1], \"%s \", abbrev);\n\t\t\tstrbuf_reset(line);\n\t\t\tfor (i = 0; split[i]; i++)\n\t\t\t\tstrbuf_addf(line, \"%s\", split[i]->buf);\n\t\t}\n\n>         while (!strbuf_getline(&line, f, '\\n')) {\n>                 if (line.len && line.len[0] == comment_line_char)\n>                         continue;\n>                 strbuf_rtrim(&line);\n>                 if (!line.len)\n>                         continue;\n>                 abbrev_sha1_in_line(&line);\n>                 string_list_append(lines, line.buf);\n>         }\n\nI took this (modulo s/line.len[0]/line.buf[0]/, and s/rtrim/trim/ to be\nrobust to leading whitespace (not really important, but doesn't harm).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"265368","messageId":"1435784916-15456-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"vpqk2ujoadw.fsf@anie.imag.fr","subject":"[PATCH v6 1/4] status: factor two rebase-related messages together","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T21:08:33Z","receivedAt":"2015-07-01T21:08:33Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nNo modification.\n\n wt-status.c | 32 ++++++++++++++++----------------\n 1 file changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex eaed4fe..8c4b806 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1027,6 +1027,20 @@ static int split_commit_in_progress(struct wt_status *s)\n \treturn split_in_progress;\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+{\n+\tif (state->branch)\n+\t\tstatus_printf_ln(s, color,\n+\t\t\t\t _(\"You are currently rebasing branch '%s' on '%s'.\"),\n+\t\t\t\t state->branch,\n+\t\t\t\t state->onto);\n+\telse\n+\t\tstatus_printf_ln(s, color,\n+\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 \t\t\t\tconst char *color)\n@@ -1034,14 +1048,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@@ -1051,14 +1058,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.5.0.rc0.7.ge1edd74.dirty\n"},{"id":"265369","messageId":"1435784916-15456-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435784916-15456-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v6 2/4] status: differentiate interactive from non-interactive rebases","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T21:08:34Z","receivedAt":"2015-07-01T21:08:34Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nNo modification.\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 8c4b806..81610dc 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1328,7 +1328,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.5.0.rc0.7.ge1edd74.dirty\n"},{"id":"265370","messageId":"1435784916-15456-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435784916-15456-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v6 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T21:08:35Z","receivedAt":"2015-07-01T21:08:35Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\ngit 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nApplied Junio's remark on C code to abbreviate sha1s and filter comments.\n\n t/t7512-status-help.sh | 111 ++++++++++++++++++++++++++++++++++++++++++++++++\n wt-status.c            | 113 +++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 224 insertions(+)\n\ndiff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh\nindex 190656d..9be0235 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 --short 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 --short 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 --short rebase_i_edit) &&\n \ttest_commit three_rebase_i main.txt three &&\n+\tCOMMIT3=$(git rev-parse --short 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 --short split_commit) &&\n \ttest_commit three_split main.txt three &&\n+\tCOMMIT3=$(git rev-parse --short split_commit) &&\n \ttest_commit four_split main.txt four &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short amend_last) &&\n \ttest_commit four_amend main.txt four &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 --short several_edits^^) &&\n+\tCOMMIT3=$(git rev-parse --short several_edits^) &&\n+\tCOMMIT4=$(git rev-parse --short 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 81610dc..0204c17 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1027,6 +1027,118 @@ static int split_commit_in_progress(struct wt_status *s)\n \treturn split_in_progress;\n }\n \n+/*\n+ * Turn\n+ * \"pick d6a2f0303e897ec257dd0e0a39a5ccb709bc2047 some message\"\n+ * into\n+ * \"pick d6a2f03 some message\"\n+ *\n+ * The function assumes that the line does not contain useless spaces\n+ * before or after the command.\n+ */\n+static void abbrev_sha1_in_line(struct strbuf *line)\n+{\n+\tstruct strbuf **split;\n+\tint i;\n+\n+\tif (starts_with(line->buf, \"exec \") ||\n+\t    starts_with(line->buf, \"x \"))\n+\t\treturn;\n+\n+\tsplit = strbuf_split_max(line, ' ', 3);\n+\tif (split[0] && split[1]) {\n+\t\tunsigned char sha1[20];\n+\t\tconst char *abbrev;\n+\n+\t\t/*\n+\t\t * strbuf_split_max left a space. Trim it and re-add\n+\t\t * it after abbreviation.\n+\t\t */\n+\t\tstrbuf_trim(split[1]);\n+\t\tif (!get_sha1(split[1]->buf, sha1)) {\n+\t\t\tabbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n+\t\t\tstrbuf_reset(split[1]);\n+\t\t\tstrbuf_addf(split[1], \"%s \", abbrev);\n+\t\t\tstrbuf_reset(line);\n+\t\t\tfor (i = 0; split[i]; i++)\n+\t\t\t\tstrbuf_addf(line, \"%s\", split[i]->buf);\n+\t\t}\n+\t}\n+\tfor (i = 0; split[i]; i++)\n+\t\tstrbuf_release(split[i]);\n+\n+}\n+\n+static void read_rebase_todolist(const char *fname, struct string_list *lines)\n+{\n+\tstruct strbuf line = STRBUF_INIT;\n+\tFILE *f = fopen(git_path(fname), \"r\");\n+\n+\tif (!f)\n+\t\tdie_errno(\"Could not open file %s for reading\", git_path(fname));\n+\twhile (!strbuf_getline(&line, f, '\\n')) {\n+\t\tif (line.len && line.buf[0] == comment_line_char)\n+\t\t\tcontinue;\n+\t\tstrbuf_trim(&line);\n+\t\tif (!line.len)\n+\t\t\tcontinue;\n+\t\tabbrev_sha1_in_line(&line);\n+\t\tstring_list_append(lines, line.buf);\n+\t}\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 string_list have_done = STRING_LIST_INIT_DUP;\n+\t\tstruct string_list yet_to_do = STRING_LIST_INIT_DUP;\n+\n+\t\tread_rebase_todolist(\"rebase-merge/done\", &have_done);\n+\t\tread_rebase_todolist(\"rebase-merge/git-rebase-todo\", &yet_to_do);\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@@ -1047,6 +1159,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.5.0.rc0.7.ge1edd74.dirty\n"},{"id":"265371","messageId":"1435784916-15456-4-git-send-email-Matthieu.Moy@imag.fr","threadId":"39754","inReplyTo":"1435784916-15456-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH v6 4/4] status: add new tests for status during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2015-07-01T21:08:36Z","receivedAt":"2015-07-01T21:08:36Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n\nExpand 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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nNo modification.\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 9be0235..49d19a3 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 --short HEAD) &&\n+\tCOMMIT3=$(git rev-parse --short HEAD^) &&\n+\tCOMMIT2=$(git rev-parse --short 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 --short HEAD) &&\n+\tCOMMIT3=$(git rev-parse --short HEAD^) &&\n+\tCOMMIT2=$(git rev-parse --short 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.5.0.rc0.7.ge1edd74.dirty\n"},{"id":"265374","messageId":"xmqqr3or7et9.fsf@gitster.dls.corp.google.com","threadId":"39754","inReplyTo":"vpqk2ujoadw.fsf@anie.imag.fr","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-01T21:23:14Z","receivedAt":"2015-07-01T21:23:14Z","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> Actually, we can do simpler: we still have the original line available,\n> ...\n>\n> I took this (modulo s/line.len[0]/line.buf[0]/, and s/rtrim/trim/ to be\n> robust to leading whitespace (not really important, but doesn't harm).\n\nI'd prefer us to be more strict when we know we are reading our own\noutput; rtrim is sensible, as the log line has end-user subject\nthe end and the subject might have a trailing whitespace we want to\ntrim, but there is no valid reason to expect leading whitespace.\n\nIn any case, I wouldn't have much time during the remainder of the\nday to requeue and/or comment; please check what I push out on 'pu'.\n\nThanks.\n"},{"id":"265384","messageId":"vpqh9pnm1hu.fsf@anie.imag.fr","threadId":"39754","inReplyTo":"xmqqr3or7et9.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-07-02T08:01:49Z","receivedAt":"2015-07-02T08:01:49Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> Actually, we can do simpler: we still have the original line available,\n>> ...\n>>\n>> I took this (modulo s/line.len[0]/line.buf[0]/, and s/rtrim/trim/ to be\n>> robust to leading whitespace (not really important, but doesn't harm).\n>\n> I'd prefer us to be more strict when we know we are reading our own\n> output; rtrim is sensible, as the log line has end-user subject\n> the end and the subject might have a trailing whitespace we want to\n> trim, but there is no valid reason to expect leading whitespace.\n\nI would agree with \"more strict\" is it was about rejecting the input (to\ncatch errors), but here we're still accepting it without complaining if\nit has leading whitespaces. So, being strict does not seem to have any\nbenefit to me. Being a bit more robust is just one character _less_ in\nthe code.\n\nActually, there's a hidden benefit in accepting not-well-formatted\ninput: it mimicks the shell equivalent closer, which means that we're\nclose to replacing the shell's collapse_todo_ids and expand_todo_ids in\nC which would avoid C/shell duplication.\n\n> --- a/wt-status.c\n> +++ b/wt-status.c\n> @@ -1046,12 +1046,8 @@ static void abbrev_sha1_in_line(struct strbuf *line)\n>                 unsigned char sha1[20];\n>                 const char *abbrev;\n>  \n> -               /*\n> -                * strbuf_split_max left a space. Trim it and re-add\n> -                * it after abbreviation.\n> -                */\n> -               strbuf_trim(split[1]);\n> -               if (!get_sha1(split[1]->buf, sha1)) {\n> +               if (!get_sha1_hex(split[1]->buf, sha1) &&\n> +                   !strcmp(split[1]->buf + 40, \" \")) {\n>                         abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);\n>                         strbuf_reset(split[1]);\n>                         strbuf_addf(split[1], \"%s \", abbrev);\n\nI prefer my version. It's simpler: when we can't expand, keep the\noriginal \"line\", don't try to deconstruct/reconstruct it, it's\nunmodified by construction. And my version works if the line is just\n\"pick <sha1>\\n\", while yours doesn't.\n\nAbout get_sha1_hex Vs get_sha1, the same argument as above applies:\naccepting short sha1s here means that implementing expand_todo_ids based\non the function would be relatively easy.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"265385","messageId":"vpqpp4bdlon.fsf@anie.imag.fr","threadId":"39754","inReplyTo":"xmqqr3or7et9.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-07-02T08:10:32Z","receivedAt":"2015-07-02T08:10:32Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> In any case, I wouldn't have much time during the remainder of the\n> day to requeue and/or comment; please check what I push out on 'pu'.\n\nBTW, I do agree with this hunk:\n\n@@ -1068,18 +1064,20 @@ static void abbrev_sha1_in_line(struct strbuf *line)\n static void read_rebase_todolist(const char *fname, struct string_list *lines)\n {\n        struct strbuf line = STRBUF_INIT;\n-       FILE *f = fopen(git_path(fname), \"r\");\n+       FILE *f = fopen(git_path(\"%s\", fname), \"r\");\n \n        if (!f)\n-               die_errno(\"Could not open file %s for reading\", git_path(fname));\n+               die_errno(\"Could not open file %s for reading\",\n+                         git_path(\"%s\", fname));\n\nLet me know if you want me to resend. In any case, I'm fine with your\n\"SQUASH ??\" version even though I prefer mine (cf. other message).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"265467","messageId":"xmqq7fqh5ecb.fsf@gitster.dls.corp.google.com","threadId":"39754","inReplyTo":"vpqh9pnm1hu.fsf@anie.imag.fr","subject":"Re: [PATCH v5 3/4] status: give more information during rebase -i","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-03T17:40:52Z","receivedAt":"2015-07-03T17:40:52Z","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> I would agree with \"more strict\" is it was about rejecting the input (to\n> catch errors), but here we're still accepting it without complaining\n\nYes, by \"more strict\", I meant that I would prefer to keep things we\ndo not understand as intact as possible, while transforming what we\ndo understand into whatever shape we deem appropriate.\n\n> Actually, there's a hidden benefit in accepting not-well-formatted\n> input: it mimicks the shell equivalent closer, which means that we're\n> close to replacing the shell's collapse_todo_ids and expand_todo_ids in\n> C which would avoid C/shell duplication.\n\n;-)\n\nBut as I said above, that is a mere \"would prefer\" preference, so I\ncan go either way.\n"},{"id":"265777","messageId":"xmqqlher1upy.fsf@gitster.dls.corp.google.com","threadId":"39754","inReplyTo":"1435784916-15456-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH v6 3/4] status: give more information during rebase -i","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-07T22:14:17Z","receivedAt":"2015-07-07T22:14:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"By the way, does this have any potential interaction with 16cf51c7\n(git-rebase--interactive.sh: add config option for custom\ninstruction format, 2015-06-13)?  I _think_ that the other topic\nshould only affect the collapsed format, so there hopefully\nshouldn't be a problem, but just double checking if you folks\nconsidered the ramifications already.\n\nThanks.\n"},{"id":"265807","messageId":"vpqr3ojjf9r.fsf@anie.imag.fr","threadId":"39754","inReplyTo":"xmqqlher1upy.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v6 3/4] status: give more information during rebase -i","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-07-08T07:10:40Z","receivedAt":"2015-07-08T07:10:40Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> By the way, does this have any potential interaction with 16cf51c7\n> (git-rebase--interactive.sh: add config option for custom\n> instruction format, 2015-06-13)?  I _think_ that the other topic\n> should only affect the collapsed format, so there hopefully\n> shouldn't be a problem, but just double checking if you folks\n> considered the ramifications already.\n\n16cf51c7 adds rebase.instructionFormat that allows changing the part\nafter <command> <sha1> in the todo-list, but this part is not parsed by\nour patch. So it's OK.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}