|
856 | 856 | test_i18ncmp expected actual
|
857 | 857 | '
|
858 | 858 |
|
| 859 | +test_expect_success 'prepare for different number of commits rebased' ' |
| 860 | + git reset --hard master && |
| 861 | + git checkout -b several_commits && |
| 862 | + test_commit one_commit main.txt one && |
| 863 | + test_commit two_commit main.txt two && |
| 864 | + test_commit three_commit main.txt three && |
| 865 | + test_commit four_commit main.txt four |
| 866 | +' |
| 867 | + |
| 868 | +test_expect_success 'status: one command done nothing remaining' ' |
| 869 | + FAKE_LINES="exec_exit_15" && |
| 870 | + export FAKE_LINES && |
| 871 | + test_when_finished "git rebase --abort" && |
| 872 | + ONTO=$(git rev-parse --short HEAD~3) && |
| 873 | + test_must_fail git rebase -i HEAD~3 && |
| 874 | + cat >expected <<EOF && |
| 875 | +interactive rebase in progress; onto $ONTO |
| 876 | +Last command done (1 command done): |
| 877 | + exec exit 15 |
| 878 | +No commands remaining. |
| 879 | +You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. |
| 880 | + (use "git commit --amend" to amend the current commit) |
| 881 | + (use "git rebase --continue" once you are satisfied with your changes) |
| 882 | +
|
| 883 | +nothing to commit (use -u to show untracked files) |
| 884 | +EOF |
| 885 | + git status --untracked-files=no >actual && |
| 886 | + test_i18ncmp expected actual |
| 887 | +' |
| 888 | + |
| 889 | +test_expect_success 'status: two commands done with some white lines in done file' ' |
| 890 | + FAKE_LINES="1 > exec_exit_15 2 3" && |
| 891 | + export FAKE_LINES && |
| 892 | + test_when_finished "git rebase --abort" && |
| 893 | + ONTO=$(git rev-parse --short HEAD~3) && |
| 894 | + COMMIT4=$(git rev-parse --short HEAD) && |
| 895 | + COMMIT3=$(git rev-parse --short HEAD^) && |
| 896 | + COMMIT2=$(git rev-parse --short HEAD^^) && |
| 897 | + test_must_fail git rebase -i HEAD~3 && |
| 898 | + cat >expected <<EOF && |
| 899 | +interactive rebase in progress; onto $ONTO |
| 900 | +Last commands done (2 commands done): |
| 901 | + pick $COMMIT2 two_commit |
| 902 | + exec exit 15 |
| 903 | +Next commands to do (2 remaining commands): |
| 904 | + pick $COMMIT3 three_commit |
| 905 | + pick $COMMIT4 four_commit |
| 906 | + (use "git rebase --edit-todo" to view and edit) |
| 907 | +You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. |
| 908 | + (use "git commit --amend" to amend the current commit) |
| 909 | + (use "git rebase --continue" once you are satisfied with your changes) |
| 910 | +
|
| 911 | +nothing to commit (use -u to show untracked files) |
| 912 | +EOF |
| 913 | + git status --untracked-files=no >actual && |
| 914 | + test_i18ncmp expected actual |
| 915 | +' |
| 916 | + |
| 917 | +test_expect_success 'status: two remaining commands with some white lines in todo file' ' |
| 918 | + FAKE_LINES="1 2 exec_exit_15 3 > 4" && |
| 919 | + export FAKE_LINES && |
| 920 | + test_when_finished "git rebase --abort" && |
| 921 | + ONTO=$(git rev-parse --short HEAD~4) && |
| 922 | + COMMIT4=$(git rev-parse --short HEAD) && |
| 923 | + COMMIT3=$(git rev-parse --short HEAD^) && |
| 924 | + COMMIT2=$(git rev-parse --short HEAD^^) && |
| 925 | + test_must_fail git rebase -i HEAD~4 && |
| 926 | + cat >expected <<EOF && |
| 927 | +interactive rebase in progress; onto $ONTO |
| 928 | +Last commands done (3 commands done): |
| 929 | + pick $COMMIT2 two_commit |
| 930 | + exec exit 15 |
| 931 | + (see more in file .git/rebase-merge/done) |
| 932 | +Next commands to do (2 remaining commands): |
| 933 | + pick $COMMIT3 three_commit |
| 934 | + pick $COMMIT4 four_commit |
| 935 | + (use "git rebase --edit-todo" to view and edit) |
| 936 | +You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. |
| 937 | + (use "git commit --amend" to amend the current commit) |
| 938 | + (use "git rebase --continue" once you are satisfied with your changes) |
| 939 | +
|
| 940 | +nothing to commit (use -u to show untracked files) |
| 941 | +EOF |
| 942 | + git status --untracked-files=no >actual && |
| 943 | + test_i18ncmp expected actual |
| 944 | +' |
| 945 | + |
859 | 946 | test_done
|
0 commit comments