]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3423-rebase-reword.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t3423-rebase-reword.sh
1 #!/bin/sh
2
3 test_description='git rebase interactive with rewording'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 . "$TEST_DIRECTORY"/lib-rebase.sh
9
10 test_expect_success 'setup' '
11 test_commit main file-1 test &&
12
13 git checkout -b stuff &&
14
15 test_commit feature_a file-2 aaa &&
16 test_commit feature_b file-2 ddd
17 '
18
19 test_expect_success 'reword without issues functions as intended' '
20 test_when_finished "reset_rebase" &&
21
22 git checkout stuff^0 &&
23
24 set_fake_editor &&
25 FAKE_LINES="pick 1 reword 2" FAKE_COMMIT_MESSAGE="feature_b_reworded" \
26 git rebase -i -v main &&
27
28 test "$(git log -1 --format=%B)" = "feature_b_reworded" &&
29 test $(git rev-list --count HEAD) = 3
30 '
31
32 test_expect_success 'reword after a conflict preserves commit' '
33 test_when_finished "reset_rebase" &&
34
35 git checkout stuff^0 &&
36
37 set_fake_editor &&
38 test_must_fail env FAKE_LINES="reword 2" \
39 git rebase -i -v main &&
40
41 git checkout --theirs file-2 &&
42 git add file-2 &&
43 FAKE_COMMIT_MESSAGE="feature_b_reworded" git rebase --continue &&
44
45 test "$(git log -1 --format=%B)" = "feature_b_reworded" &&
46 test $(git rev-list --count HEAD) = 2
47 '
48
49 test_done