Merge branch 'nd/i18n'
[git.git] / t / t3405-rebase-malformed.sh
blobda94dddc86d78830664d3a4b910ab157c2db2f0f
1 #!/bin/sh
3 test_description='rebase should handle arbitrary git message'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-rebase.sh
8 cat >F <<\EOF
9 This is an example of a commit log message
10 that does not conform to git commit convention.
12 It has two paragraphs, but its first paragraph is not friendly
13 to oneline summary format.
14 EOF
16 cat >G <<\EOF
17 commit log message containing a diff
18 EOF
21 test_expect_success setup '
23 >file1 &&
24 >file2 &&
25 git add file1 file2 &&
26 test_tick &&
27 git commit -m "Initial commit" &&
28 git branch diff-in-message &&
29 git branch empty-message-merge &&
31 git checkout -b multi-line-subject &&
32 cat F >file2 &&
33 git add file2 &&
34 test_tick &&
35 git commit -F F &&
37 git cat-file commit HEAD | sed -e "1,/^\$/d" >F0 &&
39 git checkout diff-in-message &&
40 echo "commit log message containing a diff" >G &&
41 echo "" >>G &&
42 cat G >file2 &&
43 git add file2 &&
44 git diff --cached >>G &&
45 test_tick &&
46 git commit -F G &&
48 git cat-file commit HEAD | sed -e "1,/^\$/d" >G0 &&
50 git checkout empty-message-merge &&
51 echo file3 >file3 &&
52 git add file3 &&
53 git commit --allow-empty-message -m "" &&
55 git checkout master &&
57 echo One >file1 &&
58 test_tick &&
59 git add file1 &&
60 git commit -m "Second commit"
63 test_expect_success 'rebase commit with multi-line subject' '
65 git rebase master multi-line-subject &&
66 git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 &&
68 test_cmp F0 F1 &&
69 test_cmp F F0
72 test_expect_success 'rebase commit with diff in message' '
73 git rebase master diff-in-message &&
74 git cat-file commit HEAD | sed -e "1,/^$/d" >G1 &&
75 test_cmp G0 G1 &&
76 test_cmp G G0
79 test_expect_success 'rebase -m commit with empty message' '
80 git rebase -m master empty-message-merge
83 test_expect_success 'rebase -i commit with empty message' '
84 git checkout diff-in-message &&
85 set_fake_editor &&
86 env FAKE_COMMIT_MESSAGE=" " FAKE_LINES="reword 1" \
87 git rebase -i HEAD^
90 test_done